mirror of
https://github.com/Jozufozu/Flywheel.git
synced 2024-12-27 07:26:48 +01:00
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.
This commit is contained in:
parent
0b165df0e9
commit
b7cbc29764
1 changed files with 8 additions and 1 deletions
|
@ -82,7 +82,6 @@ public class ChestVisual<T extends BlockEntity & LidBlockEntity> 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<? extends ChestBlockEntity> wrapper = chestBlock.combine(blockState, level, pos, true);
|
||||
lidProgress = wrapper.apply(ChestBlock.opennessCombiner(blockEntity));
|
||||
|
@ -91,6 +90,10 @@ public class ChestVisual<T extends BlockEntity & LidBlockEntity> extends Abstrac
|
|||
lidProgress = $ -> 0f;
|
||||
}
|
||||
|
||||
bottom.setRotation(baseRotation);
|
||||
|
||||
applyLidTransform(lidProgress.get(partialTick));
|
||||
|
||||
super.init(partialTick);
|
||||
}
|
||||
|
||||
|
@ -126,6 +129,10 @@ public class ChestVisual<T extends BlockEntity & LidBlockEntity> extends Abstrac
|
|||
}
|
||||
lastProgress = progress;
|
||||
|
||||
applyLidTransform(progress);
|
||||
}
|
||||
|
||||
private void applyLidTransform(float progress) {
|
||||
progress = 1.0F - progress;
|
||||
progress = 1.0F - progress * progress * progress;
|
||||
|
||||
|
|
Loading…
Reference in a new issue