From fe625428273cf9bba1c5e3ed1327600ee63ef0ff Mon Sep 17 00:00:00 2001 From: NopoTheGamer <40329022+NopoTheGamer@users.noreply.github.com> Date: Thu, 30 May 2024 03:51:53 +1000 Subject: Fix OneConfig crashing on the mining settings (#1187) --- .../moulberry/notenoughupdates/options/separatesections/Mining.java | 3 ++- .../github/moulberry/notenoughupdates/overlays/MiningOverlay.java | 2 +- .../notenoughupdates/miscfeatures/GlaciteTunnelWaypoints.kt | 6 +++--- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/main/java/io/github/moulberry/notenoughupdates/options/separatesections/Mining.java b/src/main/java/io/github/moulberry/notenoughupdates/options/separatesections/Mining.java index 4ccd2a06..509151f6 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/options/separatesections/Mining.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/options/separatesections/Mining.java @@ -29,6 +29,7 @@ import io.github.moulberry.moulconfig.annotations.ConfigEditorDraggableList; import io.github.moulberry.moulconfig.annotations.ConfigEditorDropdown; import io.github.moulberry.moulconfig.annotations.ConfigEditorSlider; import io.github.moulberry.moulconfig.annotations.ConfigOption; +import io.github.moulberry.moulconfig.observer.Property; import io.github.moulberry.notenoughupdates.core.config.Position; import org.jetbrains.annotations.NotNull; @@ -103,7 +104,7 @@ public class Mining { ) @ConfigEditorDropdown @ConfigAccordionId(id = 0) - public @NotNull GlaciteTunnelWaypointBehaviour tunnelWaypoints = GlaciteTunnelWaypointBehaviour.SHOW_ALL; + public @NotNull Property tunnelWaypoints = Property.of(GlaciteTunnelWaypointBehaviour.SHOW_ALL); @Expose @ConfigOption( diff --git a/src/main/java/io/github/moulberry/notenoughupdates/overlays/MiningOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/overlays/MiningOverlay.java index b21a332b..adecb334 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/overlays/MiningOverlay.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/overlays/MiningOverlay.java @@ -268,7 +268,7 @@ public class MiningOverlay extends TextTabOverlay { NotEnoughUpdates.INSTANCE.config.mining.emissaryWaypoints == 0 && !NotEnoughUpdates.INSTANCE.config.mining.titaniumAlert && NotEnoughUpdates.INSTANCE.config.mining.locWaypoints == 0 - && NotEnoughUpdates.INSTANCE.config.mining.tunnelWaypoints != Mining.GlaciteTunnelWaypointBehaviour.NONE + && NotEnoughUpdates.INSTANCE.config.mining.tunnelWaypoints.get() != Mining.GlaciteTunnelWaypointBehaviour.NONE && HotmDesires.wantsPowderInfo()) { return; } diff --git a/src/main/kotlin/io/github/moulberry/notenoughupdates/miscfeatures/GlaciteTunnelWaypoints.kt b/src/main/kotlin/io/github/moulberry/notenoughupdates/miscfeatures/GlaciteTunnelWaypoints.kt index cb4c8377..3c19f396 100644 --- a/src/main/kotlin/io/github/moulberry/notenoughupdates/miscfeatures/GlaciteTunnelWaypoints.kt +++ b/src/main/kotlin/io/github/moulberry/notenoughupdates/miscfeatures/GlaciteTunnelWaypoints.kt @@ -70,7 +70,7 @@ object GlaciteTunnelWaypoints { @SubscribeEvent fun onRender(event: RenderWorldLastEvent) { - if (NotEnoughUpdates.INSTANCE.config.mining.tunnelWaypoints == Mining.GlaciteTunnelWaypointBehaviour.NONE) + if (NotEnoughUpdates.INSTANCE.config.mining.tunnelWaypoints.get() == Mining.GlaciteTunnelWaypointBehaviour.NONE) return if (SBInfo.getInstance().scoreboardLocation !in glaciteTunnelLocations) @@ -83,7 +83,7 @@ object GlaciteTunnelWaypoints { val player = Minecraft.getMinecraft().thePlayer?.position ?: return for (entry in wantedGemstones) { val waypoints = waypointsForQuest[entry] ?: continue - val waypointLocations = when (NotEnoughUpdates.INSTANCE.config.mining.tunnelWaypoints) { + val waypointLocations = when (NotEnoughUpdates.INSTANCE.config.mining.tunnelWaypoints.get()) { Mining.GlaciteTunnelWaypointBehaviour.SHOW_ALL -> { waypoints.waypoints } @@ -92,7 +92,7 @@ object GlaciteTunnelWaypoints { listOf(waypoints.waypoints.minByOrNull { it.distanceSq(player) }) } - Mining.GlaciteTunnelWaypointBehaviour.NONE -> break + else -> break } for (waypoint in waypointLocations) { if (waypoint == null) continue -- cgit