Use undispatched coroutines and remove the IO dispatcher usage to fix the previous commit
This commit is contained in:
parent
546a4d118e
commit
c992b24b16
|
@ -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 {
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue