Compare commits

..

2 Commits

2 changed files with 8 additions and 8 deletions

View File

@ -161,11 +161,12 @@ class TerminalBlockEntity: DeviceBlockEntity(PhyBlockEntities.TERMINAL),
private fun finishPendingRequests() {
if (world!!.isClient) return
if (pendingRequests.isEmpty()) return
val finishable = pendingRequests.filter { it.isFinishable(counter) }
finishable.forEach(::stackLocateRequestCompleted)
pendingRequests.removeAll(finishable)
for (request in pendingRequests) {
if (request.isFinishable(counter)) {
stackLocateRequestCompleted(request)
}
}
}
fun addObserver() {

View File

@ -72,10 +72,9 @@ interface NetworkStackDispatcher<Insertion: NetworkStackDispatcher.PendingInsert
fun <Self, Insertion: NetworkStackDispatcher.PendingInsertion<Insertion>> Self.finishTimedOutPendingInsertions() where Self: BlockEntity, Self: NetworkStackDispatcher<Insertion> {
if (world!!.isClient) return
if (pendingInsertions.isEmpty()) return
val finishable = pendingInsertions.filter { it.isFinishable(this) }
finishable.forEach(::finishInsertion)
pendingInsertions.removeAll(finishable)
pendingInsertions
.filter { it.isFinishable(this) }
.forEach(::finishInsertion)
// todo: if a timed-out insertion can't be finished, we should probably retry after some time (exponential backoff?)
}