From 8d684679e1f874b288c90a7c781893567e3f869a Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Sat, 24 Feb 2024 20:11:00 +0100 Subject: Compact Tab List now has toggle tab support. --- .../misc/compacttablist/TabListRenderer.kt | 31 ++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'src/main/java/at/hannibal2/skyhanni/features') 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 -- cgit