diff options
author | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2024-02-24 20:11:00 +0100 |
---|---|---|
committer | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2024-02-24 20:11:00 +0100 |
commit | 8d684679e1f874b288c90a7c781893567e3f869a (patch) | |
tree | 32bad5dec73b11b7932987daee361d6705c09527 /src/main/java | |
parent | 67a7beec68dbc4e818248273679956857a7130a5 (diff) | |
download | skyhanni-8d684679e1f874b288c90a7c781893567e3f869a.tar.gz skyhanni-8d684679e1f874b288c90a7c781893567e3f869a.tar.bz2 skyhanni-8d684679e1f874b288c90a7c781893567e3f869a.zip |
Compact Tab List now has toggle tab support.
Diffstat (limited to 'src/main/java')
2 files changed, 40 insertions, 0 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/misc/compacttablist/CompactTabListConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/misc/compacttablist/CompactTabListConfig.java index 4d5530ea3..92db866a3 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/misc/compacttablist/CompactTabListConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/misc/compacttablist/CompactTabListConfig.java @@ -16,6 +16,15 @@ public class CompactTabListConfig { public boolean enabled = false; @Expose + @ConfigOption( + name = "Toggle Tab", + desc = "Use the tab key to toggle the tab list, not show tab list while the key is pressed. " + + "Similar to patcher's feature." + ) + @ConfigEditorBoolean + public boolean toggleTab = false; + + @Expose @ConfigOption(name = "Hide Hypixel Adverts", desc = "Hides text from advertising the Hypixel server or store in the tablist.") @ConfigEditorBoolean public boolean hideAdverts = false; diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/compacttablist/TabListRenderer.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/compacttablist/TabListRenderer.kt index bff4f3a42..bb5193074 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/misc/compacttablist/TabListRenderer.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/misc/compacttablist/TabListRenderer.kt @@ -1,6 +1,7 @@ package at.hannibal2.skyhanni.features.misc.compacttablist import at.hannibal2.skyhanni.SkyHanniMod +import at.hannibal2.skyhanni.events.GuiRenderEvent import at.hannibal2.skyhanni.events.SkipTabListLineEvent import at.hannibal2.skyhanni.mixins.transformers.AccessorGuiPlayerTabOverlay import at.hannibal2.skyhanni.utils.CollectionUtils.filterToMutable @@ -31,6 +32,36 @@ object TabListRenderer { if (!config.enabled) return event.isCanceled = true + if (config.toggleTab) return + + drawTabList() + } + + private var isPressed = false + private var isTabToggled = false + + @SubscribeEvent + fun onRenderOverlay(event: GuiRenderEvent.GuiOverlayRenderEvent) { + if (!LorenzUtils.inSkyBlock) return + if (!config.enabled) return + if (!config.toggleTab) return + if (Minecraft.getMinecraft().currentScreen != null) return + + if (Minecraft.getMinecraft().gameSettings.keyBindPlayerList.isPressed) { + isPressed = true + } else { + if (isPressed) { + isPressed = false + isTabToggled = !isTabToggled + } + } + + if (isTabToggled) { + drawTabList() + } + } + + private fun drawTabList() { val columns = TabListReader.renderColumns if (columns.isEmpty()) return |