From 82e0f9ab13553b60930e85ded0c7b9d7118c6835 Mon Sep 17 00:00:00 2001 From: MalkContent Date: Mon, 11 Oct 2021 21:33:54 +0200 Subject: [PATCH] cleaned up code from experimental phase --- .../blocks/wooden/WatermillBlockEntity.java | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/src/main/java/blusunrize/immersiveengineering/common/blocks/wooden/WatermillBlockEntity.java b/src/main/java/blusunrize/immersiveengineering/common/blocks/wooden/WatermillBlockEntity.java index 0a87a5b86d..523398db8c 100644 --- a/src/main/java/blusunrize/immersiveengineering/common/blocks/wooden/WatermillBlockEntity.java +++ b/src/main/java/blusunrize/immersiveengineering/common/blocks/wooden/WatermillBlockEntity.java @@ -45,7 +45,7 @@ public class WatermillBlockEntity extends IEBaseBlockEntity implements IETickabl public boolean multiblock = false; private boolean beingBroken = false; public double perTick; - private static final int globalSyncDelay = 10*20; + private static final int globalSyncDelay = 20*20; private int globalSyncDelayCounter = 1; public WatermillBlockEntity(BlockEntityType type, BlockPos pos, BlockState state) @@ -63,6 +63,8 @@ public void tickClient() @Override public void tickServer() { +// if(isDummy()) +// return; if(isBlocked())//TODO throttle? { setPerTickAndAdvance(0); @@ -112,6 +114,8 @@ public void tickServer() private void setPerTickAndAdvance(double newValue) { + if(isDummy()) + return; if(newValue!=perTick) { globalSyncDelayCounter = globalSyncDelay; @@ -120,10 +124,9 @@ private void setPerTickAndAdvance(double newValue) } else if(globalSyncDelayCounter >= 0) globalSyncDelayCounter--; - if(globalSyncDelayCounter==0) { - float newrot = syncedRot(); + float newrot = (float)(level.getGameTime()*perTick); if(rotation!=newrot) { rotation = newrot; @@ -132,7 +135,8 @@ else if(globalSyncDelayCounter >= 0) } } else - rotation = (float)(rotation+perTick)%1; + rotation += perTick; + rotation %= 1; } private boolean canUse(@Nullable BlockEntity tileEntity) @@ -350,9 +354,4 @@ public void breakDummies(BlockPos pos, BlockState state) } } } - - private float syncedRot() - { - return ((float)(level.getGameTime()*perTick))%1; - } }