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 22901e472..13e60b2b5 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 @@ -8,6 +8,7 @@ import it.unimi.dsi.fastutil.objects.ReferenceArraySet import it.unimi.dsi.fastutil.objects.ReferenceOpenHashSet import net.minecraft.core.BlockPos import org.apache.logging.log4j.LogManager +import ru.dbotthepony.mc.otm.SERVER_IS_LIVE import ru.dbotthepony.mc.otm.UNIVERSE_TICKS import ru.dbotthepony.mc.otm.capability.receiveEnergy import ru.dbotthepony.mc.otm.core.math.Decimal @@ -76,6 +77,10 @@ class EnergyCableGraph : GraphNodeList): Decimal { + return segments.minOfOrNull { it.throughput(instantSnapshot) } ?: Decimal.ZERO + } + operator fun contains(node: EnergyCableBlockEntity.Node): Boolean { return segments.any { node in it } } @@ -186,7 +191,7 @@ class EnergyCableGraph : GraphNodeList { + private fun getPath(a: EnergyCableBlockEntity.Node, b: EnergyCableBlockEntity.Node, energyToTransfer: Decimal, sort: Boolean): List { if (!a.canTraverse || !b.canTraverse) return listOf() @@ -438,7 +443,9 @@ class EnergyCableGraph : GraphNodeList