diff options
author | J10a1n15 <45315647+j10a1n15@users.noreply.github.com> | 2024-04-30 12:03:34 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-04-30 12:03:34 +0200 |
commit | ca4e3dcf0bdf78a48131cd2e925b81904cd86a4b (patch) | |
tree | ae14c27225913b2c077aa4d949721fe602a7e815 /src/main/java/at/hannibal2/skyhanni/features/gui | |
parent | c220e8271ab3370ea0f4286bada28fd64cab913f (diff) | |
download | skyhanni-ca4e3dcf0bdf78a48131cd2e925b81904cd86a4b.tar.gz skyhanni-ca4e3dcf0bdf78a48131cd2e925b81904cd86a4b.tar.bz2 skyhanni-ca4e3dcf0bdf78a48131cd2e925b81904cd86a4b.zip |
Fix: SkyHanni forcing Vanilla Scoreboard to show while using Apec (#1592)
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/features/gui')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/CustomScoreboard.kt | 25 | ||||
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/ScoreboardElements.kt | 1 |
2 files changed, 22 insertions, 4 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/CustomScoreboard.kt b/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/CustomScoreboard.kt index 957808fb5..4182b37bb 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/CustomScoreboard.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/CustomScoreboard.kt @@ -21,11 +21,13 @@ package at.hannibal2.skyhanni.features.gui.customscoreboard import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator +import at.hannibal2.skyhanni.events.ConfigLoadEvent import at.hannibal2.skyhanni.events.DebugDataCollectEvent import at.hannibal2.skyhanni.events.GuiPositionMovedEvent import at.hannibal2.skyhanni.events.GuiRenderEvent import at.hannibal2.skyhanni.events.LorenzTickEvent import at.hannibal2.skyhanni.utils.ChatUtils +import at.hannibal2.skyhanni.utils.ConditionalUtils.onToggle import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.RenderUtils.HorizontalAlignment import at.hannibal2.skyhanni.utils.RenderUtils.renderStringsAlignedWidth @@ -142,11 +144,26 @@ class CustomScoreboard { return this } + private var dirty = false + // Thank you Apec for showing that the ElementType of the stupid scoreboard is FUCKING HELMET WTF @SubscribeEvent fun onRenderScoreboard(event: RenderGameOverlayEvent.Post) { if (event.type == RenderGameOverlayEvent.ElementType.HELMET) { - GuiIngameForge.renderObjective = !isHideVanillaScoreboardEnabled() + if (isHideVanillaScoreboardEnabled()) { + GuiIngameForge.renderObjective = false + } + if (dirty) { + GuiIngameForge.renderObjective = true + dirty = false + } + } + } + + @SubscribeEvent + fun onConfigLoad(event: ConfigLoadEvent) { + onToggle(config.enabled, displayConfig.hideVanillaScoreboard) { + if (!isHideVanillaScoreboardEnabled()) dirty = true } } @@ -154,7 +171,7 @@ class CustomScoreboard { fun onDebugDataCollect(event: DebugDataCollectEvent) { event.title("Custom Scoreboard") event.addIrrelevant { - if (!config.enabled) { + if (!config.enabled.get()) { add("Custom Scoreboard disabled.") } else { ScoreboardElement.entries.map { element -> @@ -168,8 +185,8 @@ class CustomScoreboard { } } - private fun isEnabled() = LorenzUtils.inSkyBlock && config.enabled - private fun isHideVanillaScoreboardEnabled() = isEnabled() && displayConfig.hideVanillaScoreboard + private fun isEnabled() = LorenzUtils.inSkyBlock && config.enabled.get() + private fun isHideVanillaScoreboardEnabled() = isEnabled() && displayConfig.hideVanillaScoreboard.get() @SubscribeEvent fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { diff --git a/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/ScoreboardElements.kt b/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/ScoreboardElements.kt index 41e946a17..e3569a856 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/ScoreboardElements.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/ScoreboardElements.kt @@ -786,6 +786,7 @@ private fun getExtraDisplayPair(): List<ScoreboardElementType> { "Unknown Lines" to unknownLines, "Island" to HypixelData.skyBlockIsland, "Area" to HypixelData.skyBlockArea, + "Full Scoreboard" to ScoreboardData.sidebarLinesFormatted, noStackTrace = true, betaOnly = true, ) |