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 eb21cf306..593356487 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 @@ -192,16 +192,19 @@ class MatterReplicatorBlockEntity(p_155229_: BlockPos, p_155230_: BlockState) : val job = status.job val drainPerTick = job.matterPerTick * status.ticksAdvanced - if (matter.extractMatter(drainPerTick, true) < drainPerTick) { - val toDrain = (drainPerTick * Decimal(200)) - .coerceAtMost(job.matterPerTick * (status.ticks - status.workTicks + status.ticksAdvanced)) - .coerceAtLeast(Decimal.ONE) - .coerceAtMost(matter.missingMatter) + if (drainPerTick.isPositive) { + if (matter.extractMatter(drainPerTick, true) < drainPerTick) { + val toDrain = (drainPerTick * Decimal(200)) + .coerceAtMost(job.matterPerTick * (status.ticks - status.workTicks + status.ticksAdvanced)) + .coerceAtLeast(Decimal.ONE) + .coerceAtMost(matter.missingMatter) - matter.receiveMatter(matterNode.graph.extractMatter(toDrain, false), false) + matter.receiveMatter(matterNode.graph.extractMatter(toDrain, false), false) + } + + status.scale(matter.extractMatter(drainPerTick, false) / drainPerTick) } - status.scale(matter.extractMatter(drainPerTick, false) / drainPerTick) visualProgress = status.workProgress } }