aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at
diff options
context:
space:
mode:
authorJ10a1n15 <45315647+j10a1n15@users.noreply.github.com>2024-04-30 12:03:34 +0200
committerGitHub <noreply@github.com>2024-04-30 12:03:34 +0200
commitca4e3dcf0bdf78a48131cd2e925b81904cd86a4b (patch)
treeae14c27225913b2c077aa4d949721fe602a7e815 /src/main/java/at
parentc220e8271ab3370ea0f4286bada28fd64cab913f (diff)
downloadskyhanni-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')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/features/gui/customscoreboard/CustomScoreboardConfig.java3
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/features/gui/customscoreboard/DisplayConfig.java3
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/CustomScoreboard.kt25
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/ScoreboardElements.kt1
4 files changed, 26 insertions, 6 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/gui/customscoreboard/CustomScoreboardConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/gui/customscoreboard/CustomScoreboardConfig.java
index 126d4646e..b6151bd85 100644
--- a/src/main/java/at/hannibal2/skyhanni/config/features/gui/customscoreboard/CustomScoreboardConfig.java
+++ b/src/main/java/at/hannibal2/skyhanni/config/features/gui/customscoreboard/CustomScoreboardConfig.java
@@ -9,6 +9,7 @@ import io.github.notenoughupdates.moulconfig.annotations.ConfigEditorBoolean;
import io.github.notenoughupdates.moulconfig.annotations.ConfigEditorDraggableList;
import io.github.notenoughupdates.moulconfig.annotations.ConfigLink;
import io.github.notenoughupdates.moulconfig.annotations.ConfigOption;
+import io.github.notenoughupdates.moulconfig.observer.Property;
import java.util.ArrayList;
import java.util.List;
@@ -21,7 +22,7 @@ public class CustomScoreboardConfig {
)
@ConfigEditorBoolean
@FeatureToggle
- public boolean enabled = false;
+ public Property<Boolean> enabled = Property.of(false);
@Expose
@ConfigOption(
diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/gui/customscoreboard/DisplayConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/gui/customscoreboard/DisplayConfig.java
index 1c04dacd6..30008a0d2 100644
--- a/src/main/java/at/hannibal2/skyhanni/config/features/gui/customscoreboard/DisplayConfig.java
+++ b/src/main/java/at/hannibal2/skyhanni/config/features/gui/customscoreboard/DisplayConfig.java
@@ -7,6 +7,7 @@ import io.github.notenoughupdates.moulconfig.annotations.ConfigEditorBoolean;
import io.github.notenoughupdates.moulconfig.annotations.ConfigEditorDropdown;
import io.github.notenoughupdates.moulconfig.annotations.ConfigEditorSlider;
import io.github.notenoughupdates.moulconfig.annotations.ConfigOption;
+import io.github.notenoughupdates.moulconfig.observer.Property;
public class DisplayConfig {
@@ -51,7 +52,7 @@ public class DisplayConfig {
"\nĀ§cUsing mods that add their own scoreboard will not be affected by this setting!")
@ConfigEditorBoolean
@FeatureToggle
- public boolean hideVanillaScoreboard = true;
+ public Property<Boolean> hideVanillaScoreboard = Property.of(true);
@Expose
@ConfigOption(name = "Display Numbers First", desc = "Determines whether the number or line name displays first. " +
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,
)