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/at/hannibal2/skyhanni/features | |
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/at/hannibal2/skyhanni/features')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/misc/compacttablist/TabListRenderer.kt | 31 |
1 files changed, 31 insertions, 0 deletions
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 |