infiniteMcCoroutineTask

inline fun infiniteMcCoroutineTask(sync: Boolean = true, client: Boolean = false, scope: CoroutineScope = if (sync) { if (client) mcClientCoroutineScope else mcCoroutineScope } else silkCoroutineScope, period: Duration = 1.ticks, delay: Duration = Duration.ZERO, crossinline task: suspend CoroutineScope.() -> Unit): Job(source)

Allows you to use coroutines for infinitely repeating tasks.

Return

the Job for this task, which is cancellable

Parameters

sync

if true, the coroutine will be executed by the Minecraft main thread

client

if true, a dispatcher for syncing with the client main thread will be used

period

the duration between each "round" of execution

delay

the delay before the first execution begins

task

the task which should be executed