diff --git a/src/main/java/com/jozufozu/flywheel/vanilla/BellVisual.java b/src/main/java/com/jozufozu/flywheel/vanilla/BellVisual.java index 479bde389..d6126d5af 100644 --- a/src/main/java/com/jozufozu/flywheel/vanilla/BellVisual.java +++ b/src/main/java/com/jozufozu/flywheel/vanilla/BellVisual.java @@ -31,7 +31,7 @@ public class BellVisual extends AbstractBlockEntityVisual imple private OrientedInstance bell; - private float lastRingTime = Float.NaN; + private boolean wasShaking = false; public BellVisual(VisualizationContext ctx, BellBlockEntity blockEntity) { super(ctx, blockEntity); @@ -42,6 +42,8 @@ public class BellVisual extends AbstractBlockEntityVisual imple bell = createBellInstance().setPivot(0.5f, 0.75f, 0.5f) .setPosition(getVisualPosition()); + bell.setChanged(); + updateRotation(partialTick); super.init(partialTick); @@ -62,25 +64,23 @@ public class BellVisual extends AbstractBlockEntityVisual imple } private void updateRotation(float partialTick) { - float ringTime = (float) blockEntity.ticks + partialTick; - - if (ringTime == lastRingTime) { - return; - } - lastRingTime = ringTime; - if (blockEntity.shaking) { + float ringTime = (float) blockEntity.ticks + partialTick; float angle = Mth.sin(ringTime / (float) Math.PI) / (4.0F + ringTime / 3.0F); Vector3f ringAxis = blockEntity.clickDirection.getCounterClockWise() .step(); - bell.setRotation(new Quaternionf(new AxisAngle4f(angle, ringAxis))); - } else { - bell.setRotation(new Quaternionf()); - } + bell.setRotation(new Quaternionf(new AxisAngle4f(angle, ringAxis))) + .setChanged(); - bell.setChanged(); + wasShaking = true; + } else if (wasShaking) { + bell.setRotation(new Quaternionf()) + .setChanged(); + + wasShaking = false; + } } @Override diff --git a/src/main/java/com/jozufozu/flywheel/vanilla/ChestVisual.java b/src/main/java/com/jozufozu/flywheel/vanilla/ChestVisual.java index 15311ce24..01df7480c 100644 --- a/src/main/java/com/jozufozu/flywheel/vanilla/ChestVisual.java +++ b/src/main/java/com/jozufozu/flywheel/vanilla/ChestVisual.java @@ -90,6 +90,7 @@ public class ChestVisual extends Abstrac } bottom.setRotation(baseRotation); + bottom.setChanged(); applyLidTransform(lidProgress.get(partialTick)); diff --git a/src/main/java/com/jozufozu/flywheel/vanilla/ShulkerBoxVisual.java b/src/main/java/com/jozufozu/flywheel/vanilla/ShulkerBoxVisual.java index b0c99e4fb..c04326622 100644 --- a/src/main/java/com/jozufozu/flywheel/vanilla/ShulkerBoxVisual.java +++ b/src/main/java/com/jozufozu/flywheel/vanilla/ShulkerBoxVisual.java @@ -71,6 +71,9 @@ public class ShulkerBoxVisual extends AbstractBlockEntityVisual