diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/BlockEntityChemicalGenerator.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/BlockEntityChemicalGenerator.kt index 21bdeed01..ce85423c8 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/BlockEntityChemicalGenerator.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/BlockEntityChemicalGenerator.kt @@ -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 getCapability(cap: Capability, side: Direction?): LazyOptional { 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) {