diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/cable/EnergyCableGraph.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/cable/EnergyCableGraph.kt index 3fa115953..930d6e13b 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/cable/EnergyCableGraph.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/block/entity/cable/EnergyCableGraph.kt @@ -1,5 +1,6 @@ package ru.dbotthepony.mc.otm.block.entity.cable +import it.unimi.dsi.fastutil.ints.IntLists import it.unimi.dsi.fastutil.objects.ObjectLinkedOpenHashSet import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet import it.unimi.dsi.fastutil.objects.Reference2ObjectOpenHashMap @@ -110,6 +111,10 @@ class EnergyCableGraph : GraphNodeList) { segments.forEach { it.refund(amount, simulate, instantSnapshot) } } @@ -152,6 +157,7 @@ class EnergyCableGraph : GraphNodeList Decimal.ZERO) { + blockstateUpdateStep() + } + } + fun throughput(instantSnapshot: Reference2ObjectOpenHashMap): Decimal { if (lastTick != UNIVERSE_TICKS) { transferredLastTick = Decimal.ZERO @@ -229,17 +252,13 @@ class EnergyCableGraph : GraphNodeList) { if (simulate) { if (this in instantSnapshot) { - instantSnapshot[this] = maxOf(instantSnapshot[this]!! - amount, Decimal.ZERO) + instantSnapshot[this] = maxOf((instantSnapshot[this] ?: Decimal.ZERO) - amount, Decimal.ZERO) } } else { transferredLastTick = maxOf(transferredLastTick - amount, Decimal.ZERO) @@ -472,6 +491,12 @@ class EnergyCableGraph : GraphNodeList