From b7cbc297645f95de24c90ede1a2baefa9efa61e5 Mon Sep 17 00:00:00 2001 From: Jozufozu Date: Thu, 30 Nov 2023 17:14:09 -0800 Subject: [PATCH] Put a lid on it - Apply lid transform in ChestVisual#init. - Fixes a horrifying bug where all chest lids you haven't looked directly at yet appear coinciding at the origin. --- .../java/com/jozufozu/flywheel/vanilla/ChestVisual.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/jozufozu/flywheel/vanilla/ChestVisual.java b/src/main/java/com/jozufozu/flywheel/vanilla/ChestVisual.java index 32727dc5f..341215887 100644 --- a/src/main/java/com/jozufozu/flywheel/vanilla/ChestVisual.java +++ b/src/main/java/com/jozufozu/flywheel/vanilla/ChestVisual.java @@ -82,7 +82,6 @@ public class ChestVisual extends Abstrac if (block instanceof AbstractChestBlock chestBlock) { float horizontalAngle = blockState.getValue(ChestBlock.FACING).toYRot(); baseRotation.setAngleAxis(Math.toRadians(-horizontalAngle), 0, 1, 0); - bottom.setRotation(baseRotation); DoubleBlockCombiner.NeighborCombineResult wrapper = chestBlock.combine(blockState, level, pos, true); lidProgress = wrapper.apply(ChestBlock.opennessCombiner(blockEntity)); @@ -91,6 +90,10 @@ public class ChestVisual extends Abstrac lidProgress = $ -> 0f; } + bottom.setRotation(baseRotation); + + applyLidTransform(lidProgress.get(partialTick)); + super.init(partialTick); } @@ -126,6 +129,10 @@ public class ChestVisual extends Abstrac } lastProgress = progress; + applyLidTransform(progress); + } + + private void applyLidTransform(float progress) { progress = 1.0F - progress; progress = 1.0F - progress * progress * progress;