diff options
author | Linnea Gräf <nea@nea.moe> | 2024-07-01 03:42:51 +0200 |
---|---|---|
committer | Linnea Gräf <nea@nea.moe> | 2024-07-03 21:05:51 +0200 |
commit | 5ee4b8d925eb12e068038a1fd2e1f35cdd8ef87e (patch) | |
tree | a5b0a6fbc8878ae62bb2c3a01dbb255388353fda /src/main/kotlin/moe/nea/firmament/gui/hud | |
parent | dff1f9c0e2b728dba902d72816104abccc61f511 (diff) | |
download | firmament-5ee4b8d925eb12e068038a1fd2e1f35cdd8ef87e.tar.gz firmament-5ee4b8d925eb12e068038a1fd2e1f35cdd8ef87e.tar.bz2 firmament-5ee4b8d925eb12e068038a1fd2e1f35cdd8ef87e.zip |
[WIP] Remove LibGUI
Diffstat (limited to 'src/main/kotlin/moe/nea/firmament/gui/hud')
-rw-r--r-- | src/main/kotlin/moe/nea/firmament/gui/hud/MoulConfigHud.kt | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/src/main/kotlin/moe/nea/firmament/gui/hud/MoulConfigHud.kt b/src/main/kotlin/moe/nea/firmament/gui/hud/MoulConfigHud.kt index afc8740..55c9835 100644 --- a/src/main/kotlin/moe/nea/firmament/gui/hud/MoulConfigHud.kt +++ b/src/main/kotlin/moe/nea/firmament/gui/hud/MoulConfigHud.kt @@ -6,11 +6,12 @@ package moe.nea.firmament.gui.hud +import io.github.notenoughupdates.moulconfig.gui.GuiComponentWrapper import io.github.notenoughupdates.moulconfig.gui.GuiContext import io.github.notenoughupdates.moulconfig.gui.component.TextComponent -import io.github.notenoughupdates.moulconfig.gui.GuiComponentWrapper import net.minecraft.resource.ResourceManager import net.minecraft.resource.SynchronousResourceReloader +import moe.nea.firmament.events.FinalizeResourceManagerEvent import moe.nea.firmament.events.HudRenderEvent import moe.nea.firmament.gui.config.HudMeta import moe.nea.firmament.util.MC @@ -21,9 +22,11 @@ abstract class MoulConfigHud( val hudMeta: HudMeta, ) { companion object { - private val componentWrapper = object : GuiComponentWrapper(GuiContext(TextComponent("§cERROR"))) { - init { - this.client = MC.instance + private val componentWrapper by lazy { + object : GuiComponentWrapper(GuiContext(TextComponent("§cERROR"))) { + init { + this.client = MC.instance + } } } } @@ -31,7 +34,6 @@ abstract class MoulConfigHud( private var fragment: GuiContext? = null fun forceInit() { - } open fun shouldRender(): Boolean { @@ -53,11 +55,13 @@ abstract class MoulConfigHud( fragment!!.root.render(renderContextTranslated) it.context.matrices.pop() } - MC.resourceManager.registerReloader(object : SynchronousResourceReloader { - override fun reload(manager: ResourceManager?) { - fragment = null - } - }) + FinalizeResourceManagerEvent.subscribe { + MC.resourceManager.registerReloader(object : SynchronousResourceReloader { + override fun reload(manager: ResourceManager?) { + fragment = null + } + }) + } } fun loadFragment() { |