From 15d4dec2b13d4554168c6cbd78412172bfef5bdc Mon Sep 17 00:00:00 2001 From: DBotThePony Date: Sat, 3 Sep 2022 16:03:38 +0700 Subject: [PATCH] Fix matter replicator allocating jobs while not powered --- .../mc/otm/block/entity/matter/MatterReplicatorBlockEntity.kt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/matter/MatterReplicatorBlockEntity.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/matter/MatterReplicatorBlockEntity.kt index 062b19d50..125d88ee8 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/matter/MatterReplicatorBlockEntity.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/matter/MatterReplicatorBlockEntity.kt @@ -155,6 +155,10 @@ class MatterReplicatorBlockEntity(p_155229_: BlockPos, p_155230_: BlockState) : } override fun computeNextJob(): Pair { + 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)