This commit is contained in:
DBotThePony 2025-02-11 11:05:10 +07:00
parent fdc9944c17
commit 18949d65c4
Signed by: DBot
GPG Key ID: DCC23B5715498507

View File

@ -335,10 +335,13 @@ class EnergyCableGraph : GraphNodeList<EnergyCableBlockEntity.Node, EnergyCableG
v.segment.transferredLastTick = transferredLastTick
v.segment.lastPoweredStatus = lastPoweredStatus
v.segment.paths = paths.clone()
paths.forEach { it.segments.add(v.segment) }
result.add(v.segment)
}
paths.forEach { it.nodes.addAll(nodes) }
return result
}
}
@ -493,7 +496,7 @@ class EnergyCableGraph : GraphNodeList<EnergyCableBlockEntity.Node, EnergyCableG
var maxThroughput = list.paths.maxOfOrNull { it.availableThroughput } ?: Decimal.ZERO
var combinedThroughput = list.paths.iterator().map { it.availableThroughput }.reduce(Decimal.ZERO, Decimal::plus)
while (combinedThroughput < energyToTransfer && !list.saturated && ++lastTickSearches <= maxSearches) {
while (maxThroughput < energyToTransfer && !list.saturated && ++lastTickSearches <= maxSearches) {
val find = findPath(a, b, list.paths, maxThroughput)
if (find == null || find in list.paths) {