Fix matter replicator allocating jobs while not powered

This commit is contained in:
DBotThePony 2022-09-03 16:03:38 +07:00
parent 49fd0dc105
commit 15d4dec2b1
Signed by: DBot
GPG Key ID: DCC23B5715498507

View File

@ -155,6 +155,10 @@ class MatterReplicatorBlockEntity(p_155229_: BlockPos, p_155230_: BlockState) :
}
override fun computeNextJob(): Pair<ReplicatorJob?, IdleReason?> {
if (energy.batteryLevel < BASE_CONSUMPTION) {
return null to IdleReason.POWER
}
val graph = matterNode.graph as MatterNetworkGraph? ?: return null to null
val allocation = graph.allocateTask(simulate = false) ?: return null to IdleReason.OBSERVING
val stack = allocation.task.stack(1)