mirror of
https://github.com/Creators-of-Create/Create.git
synced 2025-02-05 18:05:00 +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);
|
registerAwardables(behaviours, AllAdvancements.CRAFTER, AllAdvancements.CRAFTER_LAZY);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void invalidateCaps() {
|
||||||
|
inserting.removeListener();
|
||||||
|
super.invalidateCaps();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onSpeedChanged(float previousSpeed) {
|
public void onSpeedChanged(float previousSpeed) {
|
||||||
super.onSpeedChanged(previousSpeed);
|
super.onSpeedChanged(previousSpeed);
|
||||||
|
@ -132,6 +138,7 @@ public class MechanicalCrafterBlockEntity extends KineticBlockEntity {
|
||||||
|
|
||||||
public void blockChanged() {
|
public void blockChanged() {
|
||||||
removeBehaviour(InvManipulationBehaviour.TYPE);
|
removeBehaviour(InvManipulationBehaviour.TYPE);
|
||||||
|
inserting.removeListener();
|
||||||
inserting = new InvManipulationBehaviour(this, this::getTargetFace);
|
inserting = new InvManipulationBehaviour(this, this::getTargetFace);
|
||||||
attachBehaviourLate(inserting);
|
attachBehaviourLate(inserting);
|
||||||
}
|
}
|
||||||
|
|
|
@ -273,6 +273,12 @@ public class FunnelBlockEntity extends SmartBlockEntity implements IHaveHovering
|
||||||
registerAwardables(behaviours, AllAdvancements.FUNNEL);
|
registerAwardables(behaviours, AllAdvancements.FUNNEL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void invalidateCaps() {
|
||||||
|
invManipulation.removeListener();
|
||||||
|
super.invalidateCaps();
|
||||||
|
}
|
||||||
|
|
||||||
private boolean supportsAmountOnFilter() {
|
private boolean supportsAmountOnFilter() {
|
||||||
BlockState blockState = getBlockState();
|
BlockState blockState = getBlockState();
|
||||||
boolean beltFunnelsupportsAmount = false;
|
boolean beltFunnelsupportsAmount = false;
|
||||||
|
|
|
@ -32,10 +32,10 @@ public class SmartObserverBlockEntity extends SmartBlockEntity {
|
||||||
private FilteringBehaviour filtering;
|
private FilteringBehaviour filtering;
|
||||||
private InvManipulationBehaviour observedInventory;
|
private InvManipulationBehaviour observedInventory;
|
||||||
private TankManipulationBehaviour observedTank;
|
private TankManipulationBehaviour observedTank;
|
||||||
|
|
||||||
private VersionedInventoryTrackerBehaviour invVersionTracker;
|
private VersionedInventoryTrackerBehaviour invVersionTracker;
|
||||||
private boolean sustainSignal;
|
private boolean sustainSignal;
|
||||||
|
|
||||||
public int turnOffTicks = 0;
|
public int turnOffTicks = 0;
|
||||||
|
|
||||||
public SmartObserverBlockEntity(BlockEntityType<?> type, BlockPos pos, BlockState state) {
|
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());
|
behaviours.add(observedTank = new TankManipulationBehaviour(this, towardBlockFacing).bypassSidedness());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void invalidateCaps() {
|
||||||
|
observedInventory.removeListener();
|
||||||
|
observedTank.removeListener();
|
||||||
|
super.invalidateCaps();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void tick() {
|
public void tick() {
|
||||||
super.tick();
|
super.tick();
|
||||||
|
|
||||||
if (level.isClientSide())
|
if (level.isClientSide())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
BlockState state = getBlockState();
|
BlockState state = getBlockState();
|
||||||
if (turnOffTicks > 0) {
|
if (turnOffTicks > 0) {
|
||||||
turnOffTicks--;
|
turnOffTicks--;
|
||||||
|
|
|
@ -233,6 +233,13 @@ public class ThresholdSwitchBlockEntity extends SmartBlockEntity {
|
||||||
behaviours.add(observedTank = new TankManipulationBehaviour(this, towardBlockFacing).bypassSidedness());
|
behaviours.add(observedTank = new TankManipulationBehaviour(this, towardBlockFacing).bypassSidedness());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void invalidateCaps() {
|
||||||
|
observedInventory.removeListener();
|
||||||
|
observedTank.removeListener();
|
||||||
|
super.invalidateCaps();
|
||||||
|
}
|
||||||
|
|
||||||
public float getLevelForDisplay() {
|
public float getLevelForDisplay() {
|
||||||
return currentLevel == -1 ? 0 : currentLevel;
|
return currentLevel == -1 ? 0 : currentLevel;
|
||||||
}
|
}
|
||||||
|
|
|
@ -80,6 +80,10 @@ public abstract class CapManipulationBehaviourBase<T, S extends CapManipulationB
|
||||||
targetCapability = LazyOptional.empty();
|
targetCapability = LazyOptional.empty();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void removeListener() {
|
||||||
|
targetCapability.removeListener(new HashableNonNullConsumer<>(this::onHandlerInvalidated, this));
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void lazyTick() {
|
public void lazyTick() {
|
||||||
super.lazyTick();
|
super.lazyTick();
|
||||||
|
|
Loading…
Reference in a new issue