Skip to content

Commit

Permalink
rename
Browse files Browse the repository at this point in the history
  • Loading branch information
MukjepScarlet committed Feb 24, 2025
1 parent 6d9288b commit 7742f6e
Showing 1 changed file with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,12 @@ object TickScheduler : Listenable, MinecraftInstance {
}
}

fun addScheduled(breakLoop: BooleanSupplier) {
/**
* Add a task for scheduling.
*
* @param breakLoop Stop tick the body when it returns `true`
*/
fun schedule(breakLoop: BooleanSupplier) {
if (mc.isCallingFromMinecraftThread) {
schedules += breakLoop
} else {
Expand All @@ -58,7 +63,7 @@ object TickScheduler : Listenable, MinecraftInstance {
suspend inline fun waitUntil(crossinline condition: () -> Boolean): Int =
suspendCancellableCoroutine { cont ->
var waitingTick = -1
TickScheduler.addScheduled {
TickScheduler.schedule {
waitingTick++
try {
if (condition()) {
Expand Down Expand Up @@ -98,7 +103,7 @@ fun Listenable.tickSequence(
) {
val job = GlobalScope.launch(context, block = body)

TickScheduler.addScheduled {
TickScheduler.schedule {
when {
!this@tickSequence.handleEvents() -> {
job.cancel()
Expand Down

0 comments on commit 7742f6e

Please sign in to comment.