Fix incorrect item lighting
This commit is contained in:
parent
dec91dec68
commit
5b67354e24
2 changed files with 20 additions and 1 deletions
|
@ -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);
|
||||||
|
+ }
|
||||||
|
}
|
|
@ -427,6 +427,7 @@ public class ForgeHooksClient
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final net.minecraft.client.renderer.Matrix4f flipX;
|
private static final net.minecraft.client.renderer.Matrix4f flipX;
|
||||||
|
private static final net.minecraft.client.renderer.Matrix3f flipXNormal;
|
||||||
static {
|
static {
|
||||||
|
|
||||||
flipX = new net.minecraft.client.renderer.Matrix4f(new float[]{
|
flipX = new net.minecraft.client.renderer.Matrix4f(new float[]{
|
||||||
|
@ -435,6 +436,7 @@ public class ForgeHooksClient
|
||||||
0, 0, 1, 0,
|
0, 0, 1, 0,
|
||||||
0, 0, 0, 1
|
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)
|
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 the stack is not empty, the code has added a matrix for us to use.
|
||||||
if (!stack.func_227867_d_())
|
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.Matrix4f tMat = stack.func_227866_c_().func_227870_a_();
|
||||||
|
net.minecraft.client.renderer.Matrix3f nMat = stack.func_227866_c_().func_227872_b_();
|
||||||
if (leftHandHackery)
|
if (leftHandHackery)
|
||||||
{
|
{
|
||||||
tMat.multiplyBackward(flipX);
|
tMat.multiplyBackward(flipX);
|
||||||
tMat.func_226595_a_(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_227870_a_().func_226595_a_(tMat);
|
||||||
|
matrixStack.func_227866_c_().func_227872_b_().func_226118_b_(nMat);
|
||||||
}
|
}
|
||||||
return model;
|
return model;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue