diff options
author | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-09-17 13:17:35 +0200 |
---|---|---|
committer | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-09-17 13:17:35 +0200 |
commit | 4644ac65070681cc70af20285206170a77bb2597 (patch) | |
tree | d596bb0df8c5af5ad314d136f1bc04790800e219 /src/main/java/at | |
parent | 6114bfe2dfca96e48d19df2725b2912a165bcd58 (diff) | |
download | skyhanni-4644ac65070681cc70af20285206170a77bb2597.tar.gz skyhanni-4644ac65070681cc70af20285206170a77bb2597.tar.bz2 skyhanni-4644ac65070681cc70af20285206170a77bb2597.zip |
migrate config button on pause config into gui
Diffstat (limited to 'src/main/java/at')
3 files changed, 15 insertions, 8 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/GUIConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/GUIConfig.java index f885bfc82..8013edf11 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/GUIConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/GUIConfig.java @@ -64,4 +64,10 @@ public class GUIConfig { @Expose public Position tpsDisplayPosition = new Position(10, 10, false, true); + + @Expose + @ConfigOption(name = "Config Button", desc = "Add a button to the pause menu to configure SkyHanni.") + @ConfigEditorBoolean + @FeatureToggle + public boolean configButtonOnPause = true; } diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/MiscConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/MiscConfig.java index e717003df..f50d95dca 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/MiscConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/MiscConfig.java @@ -554,11 +554,5 @@ public class MiscConfig { public boolean superpairsClicksAlert = false; @Expose - @ConfigOption(name = "Config Button", desc = "Add a button to the pause menu to configure SkyHanni.") - @ConfigEditorBoolean - @FeatureToggle - public boolean configButtonOnPause = true; - - @Expose public Position inventoryLoadPos = new Position(394, 124, false, true); } 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 076e807c8..0547a4537 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/ButtonOnPause.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/ButtonOnPause.kt @@ -2,6 +2,7 @@ package at.hannibal2.skyhanni.features.misc import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.config.ConfigGuiManager +import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator import at.hannibal2.skyhanni.utils.LorenzUtils import net.minecraft.client.gui.GuiButton import net.minecraft.client.gui.GuiIngameMenu @@ -9,13 +10,14 @@ import net.minecraftforge.client.event.GuiScreenEvent import net.minecraftforge.fml.common.eventhandler.SubscribeEvent class ButtonOnPause { + private val config get() = SkyHanniMod.feature.gui private val buttonId = System.nanoTime().toInt() @SubscribeEvent fun onGuiAction(event: GuiScreenEvent.ActionPerformedEvent.Post) { if (!LorenzUtils.onHypixel) return - if (SkyHanniMod.feature.misc.configButtonOnPause && event.gui is GuiIngameMenu && event.button.id == buttonId) { + if (config.configButtonOnPause && event.gui is GuiIngameMenu && event.button.id == buttonId) { ConfigGuiManager.openConfigGui() } } @@ -24,7 +26,7 @@ class ButtonOnPause { fun onGuiInitPost(event: GuiScreenEvent.InitGuiEvent.Post) { if (!LorenzUtils.onHypixel) return - if (SkyHanniMod.feature.misc.configButtonOnPause && event.gui is GuiIngameMenu) { + if (config.configButtonOnPause && event.gui is GuiIngameMenu) { val x = event.gui.width - 105 val x2 = x + 100 var y = event.gui.height - 22 @@ -43,4 +45,9 @@ class ButtonOnPause { event.buttonList.add(GuiButton(buttonId, x, 0.coerceAtLeast(y), 100, 20, "SkyHanni")) } } + + @SubscribeEvent + fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { + event.move(2, "misc.configButtonOnPause", "gui.configButtonOnPause") + } }
\ No newline at end of file |