diff options
author | nea <nea@nea.moe> | 2023-03-29 13:54:33 +0200 |
---|---|---|
committer | nea <nea@nea.moe> | 2023-03-29 13:54:33 +0200 |
commit | 7e9c44f0dd5e7c078df73d35cd3bf7b02ffffec6 (patch) | |
tree | 5b095f4c4c40410ab9d2d0b4e30e55e0e7c21a02 /src/main | |
parent | d90187217926ac53fdeee5420bb331a1f4335e91 (diff) | |
download | skyhanni-7e9c44f0dd5e7c078df73d35cd3bf7b02ffffec6.tar.gz skyhanni-7e9c44f0dd5e7c078df73d35cd3bf7b02ffffec6.tar.bz2 skyhanni-7e9c44f0dd5e7c078df73d35cd3bf7b02ffffec6.zip |
Bump MoulConfig for better sizes; Keep gui editor state
Diffstat (limited to 'src/main')
4 files changed, 24 insertions, 12 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/config/ConfigGuiForgeInterop.kt b/src/main/java/at/hannibal2/skyhanni/config/ConfigGuiForgeInterop.kt index 0d094dad6..f0da4febb 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/ConfigGuiForgeInterop.kt +++ b/src/main/java/at/hannibal2/skyhanni/config/ConfigGuiForgeInterop.kt @@ -22,7 +22,7 @@ class ConfigGuiForgeInterop : IModGuiFactory { override fun getHandlerFor(runtimeOptionCategoryElement: RuntimeOptionCategoryElement): RuntimeOptionGuiHandler? = null - class WrappedSkyHanniConfig(private val parent: GuiScreen) : GuiScreenElementWrapper(MoulConfigEditor(SkyHanniMod.configManager.processor)) { + class WrappedSkyHanniConfig(private val parent: GuiScreen) : GuiScreenElementWrapper(ConfigGuiManager.configEditor) { @Throws(IOException::class) override fun handleKeyboardInput() { if (Keyboard.getEventKeyState() && Keyboard.getEventKey() == Keyboard.KEY_ESCAPE) { diff --git a/src/main/java/at/hannibal2/skyhanni/config/ConfigGuiManager.kt b/src/main/java/at/hannibal2/skyhanni/config/ConfigGuiManager.kt new file mode 100644 index 000000000..d1b84f09c --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/config/ConfigGuiManager.kt @@ -0,0 +1,18 @@ +package at.hannibal2.skyhanni.config + +import at.hannibal2.skyhanni.SkyHanniMod +import io.github.moulberry.moulconfig.gui.GuiScreenElementWrapper +import io.github.moulberry.moulconfig.gui.MoulConfigEditor + +object ConfigGuiManager { + val configEditor by lazy { MoulConfigEditor(SkyHanniMod.configManager.processor) } + + fun openConfigGui(search: String? = null) { + if (search != null) { + configEditor.search(search) + } + SkyHanniMod.screenToOpen = GuiScreenElementWrapper(configEditor) + } + + +}
\ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt b/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt index 01bc17d9c..2ef9f169b 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt +++ b/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.config.commands import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.config.ConfigGuiManager import at.hannibal2.skyhanni.config.commands.SimpleCommand.ProcessCommandRunnable import at.hannibal2.skyhanni.data.ApiDataLoader import at.hannibal2.skyhanni.data.GuiEditManager @@ -13,8 +14,6 @@ import at.hannibal2.skyhanni.test.LorenzTest import at.hannibal2.skyhanni.test.PacketTest import at.hannibal2.skyhanni.test.command.CopyItemCommand import at.hannibal2.skyhanni.test.command.CopyNearbyEntitiesCommand -import io.github.moulberry.moulconfig.gui.GuiScreenElementWrapper -import io.github.moulberry.moulconfig.gui.MoulConfigEditor import net.minecraft.command.ICommandSender import net.minecraftforge.client.ClientCommandHandler @@ -25,12 +24,10 @@ object Commands { if (it[0].lowercase() == "gui") { GuiEditManager.openGuiEditor() } else { - val editor = MoulConfigEditor(SkyHanniMod.configManager.processor) - editor.search(it.joinToString(" ")) - SkyHanniMod.screenToOpen = GuiScreenElementWrapper(editor) + ConfigGuiManager.openConfigGui(it.joinToString(" ")) } } else { - SkyHanniMod.screenToOpen = GuiScreenElementWrapper(MoulConfigEditor(SkyHanniMod.configManager.processor)) + ConfigGuiManager.openConfigGui() } } diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/ButtonOnPause.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/ButtonOnPause.kt index d81f9e242..c28119857 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/ButtonOnPause.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/ButtonOnPause.kt @@ -1,9 +1,8 @@ package at.hannibal2.skyhanni.features.misc import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.config.ConfigGuiManager import at.hannibal2.skyhanni.utils.LorenzUtils -import io.github.moulberry.moulconfig.gui.GuiScreenElementWrapper -import io.github.moulberry.moulconfig.gui.MoulConfigEditor import net.minecraft.client.gui.GuiButton import net.minecraft.client.gui.GuiIngameMenu import net.minecraftforge.client.event.GuiScreenEvent @@ -17,9 +16,7 @@ class ButtonOnPause { if (!LorenzUtils.isHyPixel) return if (SkyHanniMod.feature.misc.configButtonOnPause && event.gui is GuiIngameMenu && event.button.id == buttonId) { - SkyHanniMod.screenToOpen = GuiScreenElementWrapper( - MoulConfigEditor(SkyHanniMod.configManager.processor) - ) + ConfigGuiManager.openConfigGui() } } |