diff --git a/patches/minecraft/net/minecraft/client/renderer/Matrix3f.java.patch b/patches/minecraft/net/minecraft/client/renderer/Matrix3f.java.patch new file mode 100644 index 000000000..7fc0c1359 --- /dev/null +++ b/patches/minecraft/net/minecraft/client/renderer/Matrix3f.java.patch @@ -0,0 +1,13 @@ +--- a/net/minecraft/client/renderer/Matrix3f.java ++++ b/net/minecraft/client/renderer/Matrix3f.java +@@ -406,4 +406,10 @@ + public Matrix3f func_226121_d_() { + return new Matrix3f(this); + } ++ ++ public void multiplyBackward(Matrix3f other) { ++ Matrix3f copy = other.func_226121_d_(); ++ copy.func_226118_b_(this); ++ this.func_226114_a_(copy); ++ } + } diff --git a/src/main/java/net/minecraftforge/client/ForgeHooksClient.java b/src/main/java/net/minecraftforge/client/ForgeHooksClient.java index 75c7479b3..cf7b2b8e8 100644 --- a/src/main/java/net/minecraftforge/client/ForgeHooksClient.java +++ b/src/main/java/net/minecraftforge/client/ForgeHooksClient.java @@ -427,6 +427,7 @@ public class ForgeHooksClient } private static final net.minecraft.client.renderer.Matrix4f flipX; + private static final net.minecraft.client.renderer.Matrix3f flipXNormal; static { flipX = new net.minecraft.client.renderer.Matrix4f(new float[]{ @@ -435,6 +436,7 @@ public class ForgeHooksClient 0, 0, 1, 0, 0, 0, 0, 1 }); + flipXNormal = new net.minecraft.client.renderer.Matrix3f(flipX); } public static IBakedModel handleCameraTransforms(MatrixStack matrixStack, IBakedModel model, ItemCameraTransforms.TransformType cameraTransformType, boolean leftHandHackery) @@ -445,14 +447,18 @@ public class ForgeHooksClient // If the stack is not empty, the code has added a matrix for us to use. if (!stack.func_227867_d_()) { - // TODO normal matrix? + // Apply the transformation to the real matrix stack, flipping for left hand net.minecraft.client.renderer.Matrix4f tMat = stack.func_227866_c_().func_227870_a_(); + net.minecraft.client.renderer.Matrix3f nMat = stack.func_227866_c_().func_227872_b_(); if (leftHandHackery) { tMat.multiplyBackward(flipX); tMat.func_226595_a_(flipX); + nMat.multiplyBackward(flipXNormal); + nMat.func_226118_b_(flipXNormal); } matrixStack.func_227866_c_().func_227870_a_().func_226595_a_(tMat); + matrixStack.func_227866_c_().func_227872_b_().func_226118_b_(nMat); } return model; }