From 8319b7c26de80fa541008e68acc1178b8f0ea98d Mon Sep 17 00:00:00 2001 From: DBotThePony Date: Tue, 28 Feb 2023 17:27:39 +0700 Subject: [PATCH] =?UTF-8?q?YuRaNnNzZZ=20=E2=80=94=20=D0=A1=D0=B5=D0=B3?= =?UTF-8?q?=D0=BE=D0=B4=D0=BD=D1=8F,=20=D0=B2=2015:51=20=D0=BE=D0=BD=20?= =?UTF-8?q?=D0=BF=D1=80=D0=B8=20=D1=80=D0=B5=D0=BF=D0=BB=D0=B8=D0=BA=D0=B0?= =?UTF-8?q?=D1=86=D0=B8=D0=B8=20=D0=B1=D0=B5=D1=80=D1=91=D1=82=20=D0=BA?= =?UTF-8?q?=D0=B0=D0=BA=D0=BE=D0=B5-=D1=82=D0=BE=20=D0=BA=D0=BE=D0=BB?= =?UTF-8?q?=D0=B8=D1=87=D0=B5=D1=81=D1=82=D0=B2=D0=BE=20=D0=B8=20=D0=BE?= =?UTF-8?q?=D1=81=D1=82=D0=B0=D0=B2=D0=BB=D1=8F=D0=B5=D1=82=20=D0=BF=D0=BE?= =?UTF-8?q?=D1=81=D0=BB=D0=B5=20=D1=80=D0=B5=D0=BF=D0=BB=D0=B8=D0=BA=D0=B0?= =?UTF-8?q?=D1=86=D0=B8=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../otm/block/entity/matter/MatterReplicatorBlockEntity.kt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) 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 af96a49f5..1b356d032 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 @@ -210,7 +210,7 @@ class MatterReplicatorBlockEntity(p_155229_: BlockPos, p_155230_: BlockState) : } override fun onWorkTick(requiredPower: Decimal, extractedPower: Decimal, ticksAdvanced: Double, job: ReplicatorJob): Status { - val drainPerTick = currentJob!!.matterPerTick * ticksAdvanced + val drainPerTick = job.matterPerTick * ticksAdvanced val graph = matterNode.graph as MatterNetworkGraph? ?: return Status.FAILURE_WAIT_FAST if (matter.extractMatterInner(drainPerTick, true) < drainPerTick) { @@ -233,7 +233,9 @@ class MatterReplicatorBlockEntity(p_155229_: BlockPos, p_155230_: BlockState) : } else { // в тик требуется меньше материи, чем её может хранить репликатор // примем из сети недостающее количество бака материи, или 200 тиков репликации, что меньше - val drain = graph.extractMatter(matter.missingMatter.coerceAtMost(drainPerTick * DRAIN_MULT), true) + val drain = graph.extractMatter(matter.missingMatter + .coerceAtMost(drainPerTick * DRAIN_MULT) + .coerceAtMost(job.matterPerTick * (job.ticks - workTicks - ticksAdvanced)), true) if (drain.isZero) { // в сети нет материи