aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/moe/nea/firmament/util
diff options
context:
space:
mode:
authornea <nea@nea.moe>2023-08-15 19:34:56 +0200
committernea <nea@nea.moe>2023-08-15 19:38:27 +0200
commit8c5570bfe6ab93855e24e6924fac1105fe8342ff (patch)
tree71c412ffefede775f36411531fed089d21b6d49d /src/main/kotlin/moe/nea/firmament/util
parentb32f5da88c355645a9eaf343987f10506aa25bee (diff)
downloadFirmament-8c5570bfe6ab93855e24e6924fac1105fe8342ff.tar.gz
Firmament-8c5570bfe6ab93855e24e6924fac1105fe8342ff.tar.bz2
Firmament-8c5570bfe6ab93855e24e6924fac1105fe8342ff.zip
Add ursa client
Diffstat (limited to 'src/main/kotlin/moe/nea/firmament/util')
-rw-r--r--src/main/kotlin/moe/nea/firmament/util/MinecraftDispatcher.kt20
1 files changed, 2 insertions, 18 deletions
diff --git a/src/main/kotlin/moe/nea/firmament/util/MinecraftDispatcher.kt b/src/main/kotlin/moe/nea/firmament/util/MinecraftDispatcher.kt
index 29ca6c2..5f94f41 100644
--- a/src/main/kotlin/moe/nea/firmament/util/MinecraftDispatcher.kt
+++ b/src/main/kotlin/moe/nea/firmament/util/MinecraftDispatcher.kt
@@ -6,23 +6,7 @@
package moe.nea.firmament.util
-import kotlinx.coroutines.CoroutineDispatcher
-import kotlinx.coroutines.ExperimentalCoroutinesApi
-import kotlinx.coroutines.Runnable
-import kotlin.coroutines.CoroutineContext
+import kotlinx.coroutines.asCoroutineDispatcher
import net.minecraft.client.MinecraftClient
-object MinecraftDispatcher : CoroutineDispatcher() {
- @ExperimentalCoroutinesApi
- override fun limitedParallelism(parallelism: Int): CoroutineDispatcher {
- throw UnsupportedOperationException("limitedParallelism is not supported for MinecraftDispatcher")
- }
-
- override fun isDispatchNeeded(context: CoroutineContext): Boolean =
- !MinecraftClient.getInstance().isOnThread
-
-
- override fun dispatch(context: CoroutineContext, block: Runnable) {
- MinecraftClient.getInstance().execute(block)
- }
-}
+val MinecraftDispatcher by lazy { MinecraftClient.getInstance().asCoroutineDispatcher() }