Replace exception with "short circuit" flag on cables
This commit is contained in:
parent
b10b1c0da4
commit
b9d85b7b17
@ -68,7 +68,7 @@ class EnergyCableGraph : GraphNodeList<EnergyCableBlockEntity.Node, EnergyCableG
|
||||
|
||||
class SegmentPath(private val a: BlockPos, private val b: BlockPos) {
|
||||
val segments = LinkedHashSet<Segment>()
|
||||
private var shortCircuit = false
|
||||
var shortCircuit = false
|
||||
private var lastTickTransfers = 0
|
||||
private var lastTick = 0
|
||||
|
||||
@ -516,6 +516,7 @@ class EnergyCableGraph : GraphNodeList<EnergyCableBlockEntity.Node, EnergyCableG
|
||||
// Single path, fast scenario
|
||||
val path = paths[0]
|
||||
val pathTransferred = path.transfer(residue, simulate, snapshot)
|
||||
if (pathTransferred <= Decimal.ZERO) continue
|
||||
val thisReceived = it.receiveEnergy(pathTransferred, simulate)
|
||||
|
||||
// If cable transferred more than machine accepted, then "refund" energy
|
||||
@ -539,8 +540,7 @@ class EnergyCableGraph : GraphNodeList<EnergyCableBlockEntity.Node, EnergyCableG
|
||||
val potentiallyAccepted = it.receiveEnergy(residue, true)
|
||||
|
||||
// Won't accept anything
|
||||
if (potentiallyAccepted <= Decimal.ZERO)
|
||||
continue
|
||||
if (potentiallyAccepted <= Decimal.ZERO) continue
|
||||
|
||||
// Now determine combined available throughput
|
||||
// Make a copy of snapshot, so we can freely write into it
|
||||
@ -575,7 +575,12 @@ class EnergyCableGraph : GraphNodeList<EnergyCableBlockEntity.Node, EnergyCableG
|
||||
}
|
||||
|
||||
if (!residue.isPositive) return received
|
||||
check(thisReceived <= Decimal.ZERO) { "Путом, алло, Путом, какого чёрта Путом? Путом почему ты заблокировал логику, а Путом?" }
|
||||
//check(thisReceived <= Decimal.ZERO) { "Путом, алло, Путом, какого чёрта Путом? Путом почему ты заблокировал логику, а Путом?" }
|
||||
|
||||
if (thisReceived > Decimal.ZERO) {
|
||||
LOGGER.warn("Cable path from $fromNode to $node doesn't follow common sense, disabling.")
|
||||
paths.forEach { it.shortCircuit = true }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user