aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjani270 <69345714+jani270@users.noreply.github.com>2024-04-17 22:26:47 +0200
committerGitHub <noreply@github.com>2024-04-17 22:26:47 +0200
commitfdf5c89d272beb3a8c903de1bcdaa594ad2de3d9 (patch)
tree1dd67b7029a1e6c84141844a8c07692dfa364e46
parent97b62dfaa115fb3a2b11c2520a57c06d56a83459 (diff)
downloadskyhanni-fdf5c89d272beb3a8c903de1bcdaa594ad2de3d9.tar.gz
skyhanni-fdf5c89d272beb3a8c903de1bcdaa594ad2de3d9.tar.bz2
skyhanni-fdf5c89d272beb3a8c903de1bcdaa594ad2de3d9.zip
Improvement: Patcher Coords Color and Duration (#1476)
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/ConfigUpdaterMigrator.kt2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/features/misc/MiscConfig.java12
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/features/misc/PatcherCoordsWaypointConfig.java28
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/misc/PatcherSendCoordinates.kt16
4 files changed, 46 insertions, 12 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/config/ConfigUpdaterMigrator.kt b/src/main/java/at/hannibal2/skyhanni/config/ConfigUpdaterMigrator.kt
index 817be7867..77c732678 100644
--- a/src/main/java/at/hannibal2/skyhanni/config/ConfigUpdaterMigrator.kt
+++ b/src/main/java/at/hannibal2/skyhanni/config/ConfigUpdaterMigrator.kt
@@ -12,7 +12,7 @@ import com.google.gson.JsonPrimitive
object ConfigUpdaterMigrator {
val logger = LorenzLogger("ConfigMigration")
- const val CONFIG_VERSION = 38
+ const val CONFIG_VERSION = 39
fun JsonElement.at(chain: List<String>, init: Boolean): JsonElement? {
if (chain.isEmpty()) return this
if (this !is JsonObject) return null
diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/misc/MiscConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/misc/MiscConfig.java
index 8ee2cc926..8b21e3e85 100644
--- a/src/main/java/at/hannibal2/skyhanni/config/features/misc/MiscConfig.java
+++ b/src/main/java/at/hannibal2/skyhanni/config/features/misc/MiscConfig.java
@@ -103,6 +103,11 @@ public class MiscConfig {
public NoBitsWarningConfig noBitsWarning = new NoBitsWarningConfig();
@Expose
+ @ConfigOption(name = "Patcher Coords Waypoints", desc = "")
+ @Accordion
+ public PatcherCoordsWaypointConfig patcherCoordsWaypoint = new PatcherCoordsWaypointConfig();
+
+ @Expose
@ConfigOption(name = "Show Outside SB", desc = "Show these features outside of SkyBlock.")
@ConfigEditorDraggableList
public List<OutsideSbFeature> showOutsideSB = new ArrayList<>();
@@ -188,13 +193,6 @@ public class MiscConfig {
public boolean restorePieceOfWizardPortalLore = true;
@Expose
- @ConfigOption(name = "Patcher Coords Waypoint", desc = "Highlight the coordinates sent by Patcher.")
- @ConfigEditorBoolean
- @FeatureToggle
- public boolean patcherSendCoordWaypoint = false;
-
-
- @Expose
@ConfigOption(name = "Account Upgrade Reminder", desc = "Remind you to claim account upgrades when complete.")
@ConfigEditorBoolean
@FeatureToggle
diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/misc/PatcherCoordsWaypointConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/misc/PatcherCoordsWaypointConfig.java
new file mode 100644
index 000000000..00820e966
--- /dev/null
+++ b/src/main/java/at/hannibal2/skyhanni/config/features/misc/PatcherCoordsWaypointConfig.java
@@ -0,0 +1,28 @@
+package at.hannibal2.skyhanni.config.features.misc;
+
+import at.hannibal2.skyhanni.config.FeatureToggle;
+import com.google.gson.annotations.Expose;
+import io.github.notenoughupdates.moulconfig.annotations.ConfigEditorBoolean;
+import io.github.notenoughupdates.moulconfig.annotations.ConfigEditorColour;
+import io.github.notenoughupdates.moulconfig.annotations.ConfigEditorSlider;
+import io.github.notenoughupdates.moulconfig.annotations.ConfigOption;
+
+public class PatcherCoordsWaypointConfig {
+
+ @Expose
+ @ConfigOption(name = "Enabled", desc = "Highlight the coordinates sent by Patcher.")
+ @ConfigEditorBoolean
+ @FeatureToggle
+ public boolean enabled = false;
+
+ @Expose
+ @ConfigOption(name = "Color", desc = "Color of the waypoint.")
+ @ConfigEditorColour
+ public String color = "0:194:75:197:64";
+
+ @Expose
+ @ConfigOption(name = "Duration", desc = "Duration of the waypoint.")
+ @ConfigEditorSlider(minStep = 5, maxValue = 120, minValue = 1)
+ public int duration = 60;
+
+} \ No newline at end of file
diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/PatcherSendCoordinates.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/PatcherSendCoordinates.kt
index 1467c983c..2357cdaee 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/misc/PatcherSendCoordinates.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/misc/PatcherSendCoordinates.kt
@@ -1,11 +1,13 @@
package at.hannibal2.skyhanni.features.misc
import at.hannibal2.skyhanni.SkyHanniMod
+import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator
import at.hannibal2.skyhanni.events.LorenzChatEvent
import at.hannibal2.skyhanni.events.LorenzRenderWorldEvent
import at.hannibal2.skyhanni.events.LorenzTickEvent
import at.hannibal2.skyhanni.events.LorenzWorldChangeEvent
import at.hannibal2.skyhanni.test.GriffinUtils.drawWaypointFilled
+import at.hannibal2.skyhanni.utils.ColorUtils.toChromaColor
import at.hannibal2.skyhanni.utils.LocationUtils
import at.hannibal2.skyhanni.utils.LorenzColor
import at.hannibal2.skyhanni.utils.LorenzLogger
@@ -20,6 +22,7 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
class PatcherSendCoordinates {
+ private val config get() = SkyHanniMod.feature.misc.patcherCoordsWaypoint
private val patcherBeacon = mutableListOf<PatcherBeacon>()
private val logger = LorenzLogger("misc/patchercoords")
@@ -30,7 +33,7 @@ class PatcherSendCoordinates {
@SubscribeEvent
fun onChat(event: LorenzChatEvent) {
- if (!SkyHanniMod.feature.misc.patcherSendCoordWaypoint) return
+ if (!config.enabled) return
val message = event.message.removeColor()
coordinatePattern.matchMatcher(message) {
@@ -53,12 +56,12 @@ class PatcherSendCoordinates {
@SubscribeEvent(priority = EventPriority.HIGH)
fun onWorldRender(event: LorenzRenderWorldEvent) {
- if (!SkyHanniMod.feature.misc.patcherSendCoordWaypoint) return
+ if (!config.enabled) return
for (beacon in patcherBeacon) {
val location = beacon.location
event.drawColor(location, LorenzColor.DARK_GREEN, alpha = 1f)
- event.drawWaypointFilled(location, LorenzColor.GREEN.toColor(), true, true)
+ event.drawWaypointFilled(location, config.color.toChromaColor(), true, true)
event.drawString(location.add(0.5, 0.5, 0.5), beacon.name, true, LorenzColor.DARK_BLUE.toColor())
}
}
@@ -72,7 +75,7 @@ class PatcherSendCoordinates {
patcherBeacon.removeIf { System.currentTimeMillis() / 1000 > it.time + 5 && location.distanceIgnoreY(it.location) < 5 }
// removed patcher beacon after time!
- patcherBeacon.removeIf { System.currentTimeMillis() / 1000 > it.time + 60 }
+ patcherBeacon.removeIf { System.currentTimeMillis() / 1000 > it.time + config.duration }
}
@SubscribeEvent
@@ -82,4 +85,9 @@ class PatcherSendCoordinates {
}
data class PatcherBeacon(val location: LorenzVec, val name: String, val time: Long)
+
+ @SubscribeEvent
+ fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) {
+ event.move(39, "misc.patcherSendCoordWaypoint", "misc.patcherCoordsWaypoint.enabled")
+ }
}