mirror of
https://github.com/Creators-of-Create/Create.git
synced 2025-01-27 21:38:05 +01:00
parent
e3331d363d
commit
b78688e944
5 changed files with 35 additions and 4 deletions
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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--;
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -80,6 +80,10 @@ public abstract class CapManipulationBehaviourBase<T, S extends CapManipulationB
|
|||
targetCapability = LazyOptional.empty();
|
||||
}
|
||||
|
||||
public void removeListener() {
|
||||
targetCapability.removeListener(new HashableNonNullConsumer<>(this::onHandlerInvalidated, this));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void lazyTick() {
|
||||
super.lazyTick();
|
||||
|
|
Loading…
Reference in a new issue