diff options
author | Linnea Gräf <nea@nea.moe> | 2025-03-22 19:11:16 +0100 |
---|---|---|
committer | Linnea Gräf <nea@nea.moe> | 2025-03-22 19:11:16 +0100 |
commit | b532572cbfe1fad2a22a9dd7586d6dd747466fa6 (patch) | |
tree | 0a022519bf4b74691cd7e36bd549359981cca017 | |
parent | ba3f2785b0faf7cb044374e0c49df307ee101e35 (diff) | |
download | Firmament-b532572cbfe1fad2a22a9dd7586d6dd747466fa6.tar.gz Firmament-b532572cbfe1fad2a22a9dd7586d6dd747466fa6.tar.bz2 Firmament-b532572cbfe1fad2a22a9dd7586d6dd747466fa6.zip |
feat: Add ordered waypoint reset on world swap
-rw-r--r-- | src/main/kotlin/features/world/Waypoints.kt | 17 | ||||
-rw-r--r-- | translations/en_us.json | 3 |
2 files changed, 19 insertions, 1 deletions
diff --git a/src/main/kotlin/features/world/Waypoints.kt b/src/main/kotlin/features/world/Waypoints.kt index e86223e..b5c2b66 100644 --- a/src/main/kotlin/features/world/Waypoints.kt +++ b/src/main/kotlin/features/world/Waypoints.kt @@ -14,6 +14,7 @@ import moe.nea.firmament.commands.thenExecute import moe.nea.firmament.commands.thenLiteral import moe.nea.firmament.events.CommandEvent import moe.nea.firmament.events.TickEvent +import moe.nea.firmament.events.WorldReadyEvent import moe.nea.firmament.events.WorldRenderLastEvent import moe.nea.firmament.features.FirmamentFeature import moe.nea.firmament.gui.config.ManagedConfig @@ -30,6 +31,7 @@ object Waypoints : FirmamentFeature { val tempWaypointDuration by duration("temp-waypoint-duration", 0.seconds, 1.hours) { 30.seconds } val showIndex by toggle("show-index") { true } val skipToNearest by toggle("skip-to-nearest") { false } + val resetWaypointOrderOnWorldSwap by toggle("reset-order-on-swap") { true } // TODO: look ahead size } @@ -105,6 +107,13 @@ object Waypoints : FirmamentFeature { val WAYPOINTS_SUBCOMMAND = "waypoints" @Subscribe + fun onWorldSwap(event: WorldReadyEvent) { + if (TConfig.resetWaypointOrderOnWorldSwap) { + orderedIndex = 0 + } + } + + @Subscribe fun onCommand(event: CommandEvent.SubCommand) { event.subcommand("waypoint") { thenArgument("pos", BlockPosArgumentType.blockPos()) { pos -> @@ -121,6 +130,14 @@ object Waypoints : FirmamentFeature { } } event.subcommand(WAYPOINTS_SUBCOMMAND) { + thenLiteral("reset") { + thenExecute { + orderedIndex = 0 + source.sendFeedback(tr( + "firmament.command.waypoint.reset", + "Reset your ordered waypoint index back to 0. If you want to delete all waypoints use /firm waypoints clear instead.")) + } + } thenLiteral("changeindex") { thenArgument("from", IntegerArgumentType.integer(0)) { fromIndex -> thenArgument("to", IntegerArgumentType.integer(0)) { toIndex -> diff --git a/translations/en_us.json b/translations/en_us.json index aaafc50..8033eaf 100644 --- a/translations/en_us.json +++ b/translations/en_us.json @@ -7,7 +7,6 @@ "firmament.command.waypoint.added": "Added waypoint %s %s %s.", "firmament.command.waypoint.clear": "Cleared waypoints.", "firmament.command.waypoint.import": "Imported %s waypoints from clipboard.", - "firmament.command.waypoint.import.error": "Could not import waypoints from clipboard. Make sure they are on ColeWeight format:\n[{\"x\": 69, \"y\":420, \"z\": 36}]", "firmament.command.waypoint.ordered.toggle.false": "Disabled ordered waypoints", "firmament.command.waypoint.ordered.toggle.true": "Enabled ordered waypoints", "firmament.command.waypoint.remove": "Removed waypoint %s. Other waypoints may have different indexes now.", @@ -271,6 +270,8 @@ "firmament.config.storage-overlay.scroll-speed": "Scroll Speed", "firmament.config.storage-overlay.scroll-speed.description": "Scroll speed inside of the storage overlay and overview.", "firmament.config.waypoints": "Waypoints", + "firmament.config.waypoints.reset-order-on-swap": "Reset Ordered Waypoints On Hop", + "firmament.config.waypoints.reset-order-on-swap.description": "Resets Ordered Waypoint progress after swapping to another world.", "firmament.config.waypoints.show-index": "Show ordered waypoint indexes", "firmament.config.waypoints.show-index.description": "Show the number of an ordered waypoint in the world.", "firmament.config.waypoints.skip-to-nearest": "Allow skipping waypoints", |