kettle

Kotlin utilities for Quilt mod development


Project maintained by Cypher121 Hosted on GitHub Pages — Theme by mattgraham

//kettle/coffee.cypher.kettle.scheduler/TaskContext

TaskContext

[jvm]
class TaskContext<T : Any>

Coroutine context for a Task containing methods allowing suspension of execution, such as sleepFor and waitUntil.

Functions

Name Summary
endTick [jvm]
suspend fun endTick()
Suspends the task until the next tick.
rescheduleOn [jvm]
suspend fun rescheduleOn(newScheduler: TickingScheduler<T>)
Suspends the task, removes it from the current scheduler, and registers it on the new scheduler, allowing it to resume when it ticks next.
sleepFor [jvm]
suspend fun sleepFor(ticks: Int)
Suspends the task for the specified number of ticks.
waitUntil [jvm]
suspend fun waitUntil(checkEvery: Int = 1, checkNow: Boolean = true, check: () -> Boolean)
Suspends the task until the check condition is fulfilled.
withContext [jvm]
inline fun withContext(block: T.() -> Unit)
Provides the generic context of type T that is available to the task and may change after suspension.
yield [jvm]
suspend fun yield()
Suspends the task if it has been running for longer than ExecutionConfiguration.yieldsAfterMs specified in its configuration.