Reduce batteryChargeLoop runtime if no battery is present
This commit is contained in:
parent
aabcaeaf46
commit
0198419d7f
@ -20,6 +20,19 @@ abstract class MatteryPoweredBlockEntity(p_155228_: BlockEntityType<*>, p_155229
|
||||
val batteryContainer = MatteryContainer(this::setChangedLight, 1)
|
||||
|
||||
protected fun batteryChargeLoop() {
|
||||
var hit = false
|
||||
|
||||
for (stack in batteryContainer) {
|
||||
if (!stack.isEmpty) {
|
||||
hit = true
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
if (!hit) {
|
||||
return
|
||||
}
|
||||
|
||||
var demand = energy.receiveEnergyOuter(energy.missingPower, true)
|
||||
if (demand.isZero) return
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user