Skip to content

Commit

Permalink
fix(PacketQueueManager): bad flush on event flush (CCBlueX#4784)
Browse files Browse the repository at this point in the history
  • Loading branch information
1zun4 authored and DataM0del committed Dec 13, 2024
1 parent 363df85 commit b9da879
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ object PacketQueueManager : EventListener {
}
}

fun flush(flushWhen: (PacketSnapshot) -> Boolean) = mc.renderTaskQueue.add(Runnable {
fun flush(flushWhen: (PacketSnapshot) -> Boolean) {
packetQueue.removeIf { snapshot ->
if (flushWhen(snapshot)) {
flushSnapshot(snapshot)
Expand All @@ -194,9 +194,9 @@ object PacketQueueManager : EventListener {
false
}
}
})
}

fun flush(count: Int) = mc.renderTaskQueue.add(Runnable {
fun flush(count: Int) {
// Take all packets until the counter of move packets reaches count and send them
var counter = 0

Expand All @@ -214,7 +214,7 @@ object PacketQueueManager : EventListener {
break
}
}
})
}

fun cancel() {
positions.firstOrNull().let { pos ->
Expand Down

0 comments on commit b9da879

Please sign in to comment.