Fix weird terminal behavior when inserting multiple equivalent stacks
This commit is contained in:
parent
8dbccc541e
commit
385e36918f
|
@ -29,10 +29,10 @@ interface NetworkStackDispatcher<Insertion: NetworkStackDispatcher.PendingInsert
|
||||||
}
|
}
|
||||||
|
|
||||||
fun handleCapacity(packet: CapacityPacket) {
|
fun handleCapacity(packet: CapacityPacket) {
|
||||||
val insertion = pendingInsertions.firstOrNull {
|
pendingInsertions.firstOrNull { insertion ->
|
||||||
ItemStackUtil.areEqualIgnoreAmounts(packet.stack, it.stack)
|
ItemStackUtil.areEqualIgnoreAmounts(packet.stack, insertion.stack) &&
|
||||||
}
|
insertion.results.none { it.second.ipAddress == packet.source }
|
||||||
if (insertion != null) {
|
}?.also { insertion ->
|
||||||
insertion.results.add(packet.capacity to packet.stackReceiver)
|
insertion.results.add(packet.capacity to packet.stackReceiver)
|
||||||
if (insertion.isFinishable(this)) {
|
if (insertion.isFinishable(this)) {
|
||||||
val remaining = finishInsertion(insertion)
|
val remaining = finishInsertion(insertion)
|
||||||
|
|
Loading…
Reference in New Issue