Fix chemical generator not updating it's "needs check" state
This commit is contained in:
parent
bea7ecab5f
commit
6c6f22c2a1
@ -44,7 +44,14 @@ class BlockEntityChemicalGenerator(pos: BlockPos, state: BlockState) : BlockEnti
|
||||
|
||||
private var valid = true
|
||||
private var resolver = LazyOptional.of {energy}
|
||||
@JvmField val energy = MatteryMachineEnergyStorage(this::setChangedLight, MatteryMachineEnergyStorage.MachineType.GENERATOR, MAX_ENERGY, THROUGHPUT)
|
||||
|
||||
@JvmField
|
||||
val energy = MatteryMachineEnergyStorage(this::setChangedLight, MatteryMachineEnergyStorage.MachineType.GENERATOR, MAX_ENERGY, THROUGHPUT)
|
||||
|
||||
override fun setChangedLight() {
|
||||
super.setChangedLight()
|
||||
check = true
|
||||
}
|
||||
|
||||
override fun <T> getCapability(cap: Capability<T>, side: Direction?): LazyOptional<T> {
|
||||
if (valid && (cap === MatteryCapability.ENERGY || cap === CapabilityEnergy.ENERGY) && side !== blockState.getValue(BlockMatteryRotatable.FACING))
|
||||
@ -148,10 +155,7 @@ class BlockEntityChemicalGenerator(pos: BlockPos, state: BlockState) : BlockEnti
|
||||
}
|
||||
}
|
||||
|
||||
val container = MatteryContainer({
|
||||
setChangedLight()
|
||||
check = true
|
||||
}, 2)
|
||||
val container = MatteryContainer(this::setChangedLight, 2)
|
||||
|
||||
val itemHandler = container.handler(fun (slot, stack): Boolean {
|
||||
if (slot == 0)
|
||||
@ -177,7 +181,7 @@ class BlockEntityChemicalGenerator(pos: BlockPos, state: BlockState) : BlockEnti
|
||||
var workingTicksTotal = 0
|
||||
private set
|
||||
|
||||
private var check = false
|
||||
private var check = true
|
||||
|
||||
private fun workWithPower(it: IEnergyStorage) {
|
||||
if (it is IMatteryEnergyStorage) {
|
||||
|
Loading…
Reference in New Issue
Block a user