diff --git a/src/main/java/dev/dubhe/anvilcraft/block/entity/BaseLaserBlockEntity.java b/src/main/java/dev/dubhe/anvilcraft/block/entity/BaseLaserBlockEntity.java index c75618d13..4efbe2dd1 100644 --- a/src/main/java/dev/dubhe/anvilcraft/block/entity/BaseLaserBlockEntity.java +++ b/src/main/java/dev/dubhe/anvilcraft/block/entity/BaseLaserBlockEntity.java @@ -77,19 +77,14 @@ private boolean canPassThrough(Direction direction, BlockPos blockPos) { } public void updateIrradiateBlockPos(BlockPos newPos) { - if (newPos == irradiateBlockPos) return; if (irradiateBlockPos == null) { + if (newPos != null) + markChanged(); irradiateBlockPos = newPos; - markChanged(); return; } - if (newPos == null) { - irradiateBlockPos = null; + if (!irradiateBlockPos.equals(newPos)) markChanged(); - return; - } - if (irradiateBlockPos.equals(newPos)) return; - markChanged(); irradiateBlockPos = newPos; } diff --git a/src/main/java/dev/dubhe/anvilcraft/block/entity/RubyPrismBlockEntity.java b/src/main/java/dev/dubhe/anvilcraft/block/entity/RubyPrismBlockEntity.java index 57fe65da7..b20084017 100644 --- a/src/main/java/dev/dubhe/anvilcraft/block/entity/RubyPrismBlockEntity.java +++ b/src/main/java/dev/dubhe/anvilcraft/block/entity/RubyPrismBlockEntity.java @@ -11,7 +11,6 @@ import org.jetbrains.annotations.NotNull; public class RubyPrismBlockEntity extends BaseLaserBlockEntity { - private boolean enabledLastTick = false; private boolean enabled = false; private RubyPrismBlockEntity(BlockEntityType type, BlockPos pos, BlockState blockState) { @@ -27,16 +26,14 @@ private RubyPrismBlockEntity(BlockEntityType type, BlockPos pos, BlockState b } public void tick(@NotNull Level level) { - resetState(); - if (enabled || enabledLastTick) { + if (enabled) { emitLaser(getFacing()); } - enabledLastTick = enabled; if (laserLevel == 0) { enabled = false; - enabledLastTick = false; } super.tick(level); + resetState(); } @Override