From 4644ac65070681cc70af20285206170a77bb2597 Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Sun, 17 Sep 2023 13:17:35 +0200 Subject: migrate config button on pause config into gui --- .../java/at/hannibal2/skyhanni/config/features/GUIConfig.java | 6 ++++++ .../at/hannibal2/skyhanni/config/features/MiscConfig.java | 6 ------ .../java/at/hannibal2/skyhanni/features/misc/ButtonOnPause.kt | 11 +++++++++-- 3 files changed, 15 insertions(+), 8 deletions(-) (limited to 'src/main/java/at') 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 @@ -553,12 +553,6 @@ public class MiscConfig { @FeatureToggle 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 -- cgit