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 2019-12-18 00:45:06 +01:00
parent eaac0c17a4
commit 599a754b60
4 changed files with 14 additions and 45 deletions

View file

@ -23,7 +23,7 @@
p_225623_4_.func_227861_a_((double)f7, (double)f8, (double)f9);
}
@@ -75,18 +72,19 @@
@@ -75,18 +72,18 @@
float f11 = (this.field_177079_e.nextFloat() * 2.0F - 1.0F) * 0.15F;
float f13 = (this.field_177079_e.nextFloat() * 2.0F - 1.0F) * 0.15F;
float f10 = (this.field_177079_e.nextFloat() * 2.0F - 1.0F) * 0.15F;
@ -37,9 +37,7 @@
}
}
- this.field_177080_a.func_229111_a_(itemstack, ItemCameraTransforms.TransformType.GROUND, false, p_225623_4_, p_225623_5_, p_225623_6_, OverlayTexture.field_229196_a_, ibakedmodel);
+ IBakedModel transformedModel = net.minecraftforge.client.ForgeHooksClient.handleCameraTransforms(p_225623_4_, ibakedmodel, ItemCameraTransforms.TransformType.GROUND, false);
+ this.field_177080_a.func_229111_a_(itemstack, ItemCameraTransforms.TransformType.GROUND, false, p_225623_4_, p_225623_5_, p_225623_6_, OverlayTexture.field_229196_a_, transformedModel);
this.field_177080_a.func_229111_a_(itemstack, ItemCameraTransforms.TransformType.GROUND, false, p_225623_4_, p_225623_5_, p_225623_6_, OverlayTexture.field_229196_a_, ibakedmodel);
p_225623_4_.func_227865_b_();
if (!flag) {
- p_225623_4_.func_227861_a_((double)(0.0F * f4), (double)(0.0F * f5), (double)(0.09375F * f6));
@ -47,7 +45,7 @@
}
}
@@ -97,4 +95,21 @@
@@ -97,4 +94,21 @@
public ResourceLocation func_110775_a(ItemEntity p_110775_1_) {
return AtlasTexture.field_110575_b;
}

View file

@ -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;
}

View file

@ -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)

View file

@ -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 &&