Fix items in ground being too small, we were applying perspectives twice.

Restore forge patch and fix a tiny mistake in it.
This commit is contained in:
David Quintana committed 2019-12-18 00:46:29 +01:00
1 parent eaac0c17a4
commit 599a754b60
4 files changed
+14 -45

No files matched your search

@@ -811,11 +811,9 @@ public class ForgeHooksClient
@SuppressWarnings("deprecation")
public static IBakedModel handlePerspective(IBakedModel model, ItemCameraTransforms.TransformType type, MatrixStack stack)
{
if (!model.getItemCameraTransforms().getTransform(type).equals(ItemTransformVec3f.DEFAULT))
{
// Push to the matrix to make it not empty and indicate that we want to transform things
stack.func_227860_a_();
model.getItemCameraTransforms().getTransform(type).func_228830_a_(false, stack);
TransformationMatrix tr = TransformationHelper.toTransformation(model.getItemCameraTransforms().getTransform(type));
if(!tr.isIdentity()) {
tr.push(stack);
}
return model;
}
@@ -42,12 +42,17 @@ public interface IForgeTransformationMatrix
default void push(MatrixStack stack)
{
stack.func_227860_a_();
stack.func_227863_a_(getTransformaion().func_227989_d_());
Vector3f trans = getTransformaion().getTranslation();
stack.func_227861_a_(trans.getX(), trans.getY(), trans.getZ());
stack.func_227863_a_(getTransformaion().getRightRot());
stack.func_227863_a_(getTransformaion().func_227989_d_());
Vector3f scale = getTransformaion().getScale();
stack.func_227861_a_(scale.getX(), scale.getY(), scale.getZ());
stack.func_227862_a_(scale.getX(), scale.getY(), scale.getZ());
stack.func_227863_a_(getTransformaion().getRightRot());
}
default TransformationMatrix compose(TransformationMatrix other)
@@ -112,38 +112,6 @@ public final class TransformationHelper
);
}
private static final EnumMap<Direction, TransformationMatrix> vanillaUvTransformLocalToGlobal = Maps.newEnumMap(Direction.class);
private static final EnumMap<Direction, TransformationMatrix> vanillaUvTransformGlobalToLocal = Maps.newEnumMap(Direction.class);
static
{
vanillaUvTransformLocalToGlobal.put(Direction.SOUTH, TransformationMatrix.func_227983_a_());
vanillaUvTransformLocalToGlobal.put(Direction.EAST, new TransformationMatrix(null,
new Quaternion(Vector3f.field_229181_d_, 90,true), null, null));
vanillaUvTransformLocalToGlobal.put(Direction.WEST, new TransformationMatrix(null,
new Quaternion(Vector3f.field_229181_d_, -90,true), null, null));
vanillaUvTransformLocalToGlobal.put(Direction.NORTH, new TransformationMatrix(null,
new Quaternion(Vector3f.field_229181_d_, 180,true), null, null));
vanillaUvTransformLocalToGlobal.put(Direction.UP, new TransformationMatrix(null,
new Quaternion(Vector3f.field_229179_b_, -90,true), null, null));
vanillaUvTransformLocalToGlobal.put(Direction.DOWN, new TransformationMatrix(null,
new Quaternion(Vector3f.field_229179_b_, 90,true), null, null));
for(Direction side : Direction.values())
{
vanillaUvTransformGlobalToLocal.put(side, vanillaUvTransformLocalToGlobal.get(side).inverse());
}
}
public static TransformationMatrix getUVLockTransform(TransformationMatrix matrix, Direction originalSide)
{
Direction newSide = matrix.rotateTransform(originalSide);
return vanillaUvTransformGlobalToLocal.get(originalSide)
.compose(matrix.inverse().blockCornerToCenter())
.compose(vanillaUvTransformLocalToGlobal.get(newSide))
.blockCenterToCorner();
}
public static boolean epsilonEquals(Vector4f v1, Vector4f v2, float epsilon)
{
return MathHelper.abs(v1.getX()-v2.getX()) < epsilon &&