From 2e9f4daf224e6d44eea52fefb2da9dc554cc324e Mon Sep 17 00:00:00 2001 From: martimavocado <39881008+martimavocado@users.noreply.github.com> Date: Sun, 3 Mar 2024 21:47:48 +0000 Subject: Feature: Toggle to only render Custom Text Box while in GUIs (#1099) --- .../hannibal2/skyhanni/config/features/gui/TextBoxConfig.java | 5 +++++ .../java/at/hannibal2/skyhanni/features/misc/CustomTextBox.kt | 10 ++++++++++ 2 files changed, 15 insertions(+) (limited to 'src/main/java/at') diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/gui/TextBoxConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/gui/TextBoxConfig.java index 134732465..2089fc88e 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/gui/TextBoxConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/gui/TextBoxConfig.java @@ -14,6 +14,11 @@ public class TextBoxConfig { @ConfigEditorBoolean public boolean enabled = false; + @Expose + @ConfigOption(name = "Only in GUI", desc = "Only show the textbox while an Inventory is open.") + @ConfigEditorBoolean + public boolean onlyInGUI = false; + @Expose @ConfigOption(name = "Text", desc = "Enter text you want to display here.\n" + "§eUse '&' as the colour code character.\n" + diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/CustomTextBox.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/CustomTextBox.kt index ffe6a79ae..a2369fc38 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/CustomTextBox.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/CustomTextBox.kt @@ -25,9 +25,19 @@ class CustomTextBox { private fun String.format() = replace("&", "§").split("\\n").toList() + @SubscribeEvent + fun onRenderGUIOverlay(event: GuiRenderEvent.ChestGuiOverlayRenderEvent) { + if (!config.enabled) return + if (!config.onlyInGUI) return + if (!LorenzUtils.inSkyBlock) return + + config.position.renderStrings(display, posLabel = "Custom Text Box") + } + @SubscribeEvent fun onRenderOverlay(event: GuiRenderEvent.GuiOverlayRenderEvent) { if (!config.enabled) return + if (config.onlyInGUI) return if (!LorenzUtils.inSkyBlock) return config.position.renderStrings(display, posLabel = "Custom Text Box") -- cgit