From faaebe7a072a3b999132c2dd87512d1230a03f2b Mon Sep 17 00:00:00 2001 From: tterrag Date: Tue, 17 Dec 2019 17:37:39 -0500 Subject: [PATCH] Remove uvlock hook, fixes broken stair/fence/etc models --- .../renderer/model/FaceBakery.java.patch | 9 ----- .../client/ForgeHooksClient.java | 37 +------------------ 2 files changed, 1 insertion(+), 45 deletions(-) diff --git a/patches/minecraft/net/minecraft/client/renderer/model/FaceBakery.java.patch b/patches/minecraft/net/minecraft/client/renderer/model/FaceBakery.java.patch index 81cfaecb5..273e517af 100644 --- a/patches/minecraft/net/minecraft/client/renderer/model/FaceBakery.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/model/FaceBakery.java.patch @@ -1,14 +1,5 @@ --- a/net/minecraft/client/renderer/model/FaceBakery.java +++ b/net/minecraft/client/renderer/model/FaceBakery.java -@@ -24,7 +24,7 @@ - public BakedQuad func_228824_a_(Vector3f p_228824_1_, Vector3f p_228824_2_, BlockPartFace p_228824_3_, TextureAtlasSprite p_228824_4_, Direction p_228824_5_, IModelTransform p_228824_6_, @Nullable BlockPartRotation p_228824_7_, boolean p_228824_8_, ResourceLocation p_228824_9_) { - BlockFaceUV blockfaceuv = p_228824_3_.field_178243_e; - if (p_228824_6_.func_188049_c()) { -- blockfaceuv = func_228821_a_(p_228824_3_.field_178243_e, p_228824_5_, p_228824_6_.func_225615_b_(), p_228824_9_); -+ blockfaceuv = net.minecraftforge.client.ForgeHooksClient.applyUVLock(p_228824_3_.field_178243_e, p_228824_5_, p_228824_6_.func_225615_b_(), p_228824_9_); - } - - float[] afloat = new float[blockfaceuv.field_178351_a.length]; @@ -43,7 +43,8 @@ this.func_178408_a(aint, direction); } diff --git a/src/main/java/net/minecraftforge/client/ForgeHooksClient.java b/src/main/java/net/minecraftforge/client/ForgeHooksClient.java index 735ba033c..35c59eedf 100644 --- a/src/main/java/net/minecraftforge/client/ForgeHooksClient.java +++ b/src/main/java/net/minecraftforge/client/ForgeHooksClient.java @@ -722,6 +722,7 @@ public class ForgeHooksClient /** * internal, relies on fixed format of FaceBakery */ + // TODO Do we need this? public static void fillNormal(int[] faceData, Direction facing) { Vector3f v1 = getVertexPos(faceData, 3); @@ -787,42 +788,6 @@ public class ForgeHooksClient return from.getItem().shouldCauseReequipAnimation(from, to, changed); } - public static BlockFaceUV applyUVLock(BlockFaceUV blockFaceUV, Direction originalSide, TransformationMatrix rotation, ResourceLocation p_228824_9_) - { - TransformationMatrix global = new TransformationMatrix(rotation.func_227988_c_()); - Matrix4f uv = TransformationHelper.getUVLockTransform(global, originalSide).func_227988_c_(); - float u0 = blockFaceUV.getVertexU(blockFaceUV.getVertexRotatedRev(0)); - float v0 = blockFaceUV.getVertexV(blockFaceUV.getVertexRotatedRev(0)); - Vector4f vec = new Vector4f(u0 / 16, v0 / 16, 0, 1); - vec.func_229372_a_(uv); - float uMin = 16 * vec.getX(); // / vec.w; - float vMin = 16 * vec.getY(); // / vec.w; - float u1 = blockFaceUV.getVertexU(blockFaceUV.getVertexRotatedRev(2)); - float v1 = blockFaceUV.getVertexV(blockFaceUV.getVertexRotatedRev(2)); - vec.set(u1 / 16,v1 / 16,0,1); - vec.func_229372_a_(uv); - float uMax = 16 * vec.getX(); // / vec.w; - float vMax = 16 * vec.getY(); // / vec.w; - if (uMin > uMax && u0 < u1 || uMin < uMax && u0 > u1) - { - float t = uMin; - uMin = uMax; - uMax = t; - } - if (vMin > vMax && v0 < v1 || vMin < vMax && v0 > v1) - { - float t = vMin; - vMin = vMax; - vMax = t; - } - float a = (float)Math.toRadians(blockFaceUV.rotation); - Vector3f rv = new Vector3f(MathHelper.cos(a), MathHelper.sin(a), 0); - Matrix3f rot = new Matrix3f(uv); - rv.func_229188_a_(rot); - int angle = MathHelper.normalizeAngle(-(int)Math.round(Math.toDegrees(Math.atan2(rv.getY(), rv.getX())) / 90) * 90, 360); - return new BlockFaceUV(new float[]{ uMin, vMin, uMax, vMax }, angle); - } - public static RenderGameOverlayEvent.BossInfo bossBarRenderPre(MainWindow res, ClientBossInfo bossInfo, int x, int y, int increment) { RenderGameOverlayEvent.BossInfo evt = new RenderGameOverlayEvent.BossInfo(new RenderGameOverlayEvent(Animation.getPartialTickTime(), res),