aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni/features
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/misc/compacttablist/TabListRenderer.kt31
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