Skip to content

Commit

Permalink
Run tickTask tasks on MC game thread
Browse files Browse the repository at this point in the history
  • Loading branch information
My-Name-Is-Jeff committed Dec 8, 2023
1 parent cc699b0 commit af0404c
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/main/kotlin/gg/skytils/skytilsmod/core/tick.kt
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ fun <T> tickTask(ticks: Int, repeats: Boolean = false, task: () -> T) =
flow {
do {
Events.await<TickEvent>(ticks)
emit(task())
emit(withContext(Dispatchers.MC) {
task()
})
} while (repeats)
}.flowOn(Tick.dispatcher)

0 comments on commit af0404c

Please sign in to comment.