diff --git a/common/src/main/kotlin/fr/username404/snowygui/config/Configuration.kt b/common/src/main/kotlin/fr/username404/snowygui/config/Configuration.kt index c76dca5..defa356 100644 --- a/common/src/main/kotlin/fr/username404/snowygui/config/Configuration.kt +++ b/common/src/main/kotlin/fr/username404/snowygui/config/Configuration.kt @@ -12,7 +12,7 @@ import fr.username404.snowygui.gui.feature.Category import fr.username404.snowygui.gui.feature.Macro import io.github.config4k.extract import io.github.config4k.getValue -import kotlinx.coroutines.Dispatchers +import kotlinx.coroutines.CoroutineStart import kotlinx.coroutines.coroutineScope import kotlinx.coroutines.launch import kotlinx.coroutines.runBlocking @@ -53,7 +53,7 @@ object Configuration { private val configDirectory: String = (Minecraft.getInstance().gameDirectory.absolutePath + File.separator + "config").also { File(it).mkdir() } private val file: File = File(configDirectory + File.separator + "snowy.conf") private suspend fun writeConfig(c: Config) = coroutineScope { - launch(Dispatchers.IO) { + launch(start = CoroutineStart.UNDISPATCHED) { file.writeText( """ |Snowy { diff --git a/common/src/main/kotlin/fr/username404/snowygui/gui/elements/ClickBox.kt b/common/src/main/kotlin/fr/username404/snowygui/gui/elements/ClickBox.kt index 58298b4..29b19c1 100644 --- a/common/src/main/kotlin/fr/username404/snowygui/gui/elements/ClickBox.kt +++ b/common/src/main/kotlin/fr/username404/snowygui/gui/elements/ClickBox.kt @@ -12,6 +12,7 @@ import fr.username404.snowygui.gui.feature.ButtonImpl import fr.username404.snowygui.gui.feature.Category import fr.username404.snowygui.gui.feature.Colors import io.github.config4k.extract +import kotlinx.coroutines.CoroutineStart import kotlinx.coroutines.launch import kotlinx.coroutines.runBlocking import net.minecraft.client.Minecraft @@ -104,7 +105,7 @@ class ClickBox( RenderSystem.enableTexture() RenderSystem.disableBlend() - val renderButtons = if (buttons.isNotEmpty()) launch { + val renderButtons = if (buttons.isNotEmpty()) launch(start = CoroutineStart.UNDISPATCHED) { buttonsProgressBar.apply { x = this@ClickBox.x + this@ClickBox.width - 3 y = this@ClickBox.y + this@ClickBox.height + 3