diff --git a/src/main/java/com/simibubi/create/content/kinetics/crafter/MechanicalCrafterBlockEntity.java b/src/main/java/com/simibubi/create/content/kinetics/crafter/MechanicalCrafterBlockEntity.java index 4dc940a64..d646d30cc 100644 --- a/src/main/java/com/simibubi/create/content/kinetics/crafter/MechanicalCrafterBlockEntity.java +++ b/src/main/java/com/simibubi/create/content/kinetics/crafter/MechanicalCrafterBlockEntity.java @@ -120,6 +120,12 @@ public class MechanicalCrafterBlockEntity extends KineticBlockEntity { registerAwardables(behaviours, AllAdvancements.CRAFTER, AllAdvancements.CRAFTER_LAZY); } + @Override + public void invalidateCaps() { + inserting.removeListener(); + super.invalidateCaps(); + } + @Override public void onSpeedChanged(float previousSpeed) { super.onSpeedChanged(previousSpeed); @@ -132,6 +138,7 @@ public class MechanicalCrafterBlockEntity extends KineticBlockEntity { public void blockChanged() { removeBehaviour(InvManipulationBehaviour.TYPE); + inserting.removeListener(); inserting = new InvManipulationBehaviour(this, this::getTargetFace); attachBehaviourLate(inserting); } diff --git a/src/main/java/com/simibubi/create/content/logistics/funnel/FunnelBlockEntity.java b/src/main/java/com/simibubi/create/content/logistics/funnel/FunnelBlockEntity.java index 00474106b..8ff868acd 100644 --- a/src/main/java/com/simibubi/create/content/logistics/funnel/FunnelBlockEntity.java +++ b/src/main/java/com/simibubi/create/content/logistics/funnel/FunnelBlockEntity.java @@ -273,6 +273,12 @@ public class FunnelBlockEntity extends SmartBlockEntity implements IHaveHovering registerAwardables(behaviours, AllAdvancements.FUNNEL); } + @Override + public void invalidateCaps() { + invManipulation.removeListener(); + super.invalidateCaps(); + } + private boolean supportsAmountOnFilter() { BlockState blockState = getBlockState(); boolean beltFunnelsupportsAmount = false; diff --git a/src/main/java/com/simibubi/create/content/redstone/smartObserver/SmartObserverBlockEntity.java b/src/main/java/com/simibubi/create/content/redstone/smartObserver/SmartObserverBlockEntity.java index e1c202639..34663ce88 100644 --- a/src/main/java/com/simibubi/create/content/redstone/smartObserver/SmartObserverBlockEntity.java +++ b/src/main/java/com/simibubi/create/content/redstone/smartObserver/SmartObserverBlockEntity.java @@ -32,10 +32,10 @@ public class SmartObserverBlockEntity extends SmartBlockEntity { private FilteringBehaviour filtering; private InvManipulationBehaviour observedInventory; private TankManipulationBehaviour observedTank; - + private VersionedInventoryTrackerBehaviour invVersionTracker; private boolean sustainSignal; - + public int turnOffTicks = 0; public SmartObserverBlockEntity(BlockEntityType type, BlockPos pos, BlockState state) { @@ -56,13 +56,20 @@ public class SmartObserverBlockEntity extends SmartBlockEntity { behaviours.add(observedTank = new TankManipulationBehaviour(this, towardBlockFacing).bypassSidedness()); } + @Override + public void invalidateCaps() { + observedInventory.removeListener(); + observedTank.removeListener(); + super.invalidateCaps(); + } + @Override public void tick() { super.tick(); - + if (level.isClientSide()) return; - + BlockState state = getBlockState(); if (turnOffTicks > 0) { turnOffTicks--; diff --git a/src/main/java/com/simibubi/create/content/redstone/thresholdSwitch/ThresholdSwitchBlockEntity.java b/src/main/java/com/simibubi/create/content/redstone/thresholdSwitch/ThresholdSwitchBlockEntity.java index 0163ed260..dcb42fb44 100644 --- a/src/main/java/com/simibubi/create/content/redstone/thresholdSwitch/ThresholdSwitchBlockEntity.java +++ b/src/main/java/com/simibubi/create/content/redstone/thresholdSwitch/ThresholdSwitchBlockEntity.java @@ -233,6 +233,13 @@ public class ThresholdSwitchBlockEntity extends SmartBlockEntity { behaviours.add(observedTank = new TankManipulationBehaviour(this, towardBlockFacing).bypassSidedness()); } + @Override + public void invalidateCaps() { + observedInventory.removeListener(); + observedTank.removeListener(); + super.invalidateCaps(); + } + public float getLevelForDisplay() { return currentLevel == -1 ? 0 : currentLevel; } diff --git a/src/main/java/com/simibubi/create/foundation/blockEntity/behaviour/inventory/CapManipulationBehaviourBase.java b/src/main/java/com/simibubi/create/foundation/blockEntity/behaviour/inventory/CapManipulationBehaviourBase.java index 9b25a050a..e13de96b8 100644 --- a/src/main/java/com/simibubi/create/foundation/blockEntity/behaviour/inventory/CapManipulationBehaviourBase.java +++ b/src/main/java/com/simibubi/create/foundation/blockEntity/behaviour/inventory/CapManipulationBehaviourBase.java @@ -80,6 +80,10 @@ public abstract class CapManipulationBehaviourBase(this::onHandlerInvalidated, this)); + } + @Override public void lazyTick() { super.lazyTick();