diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/de/hysky/skyblocker/skyblock/dwarven/CrystalsLocationsManager.java | 34 | ||||
-rw-r--r-- | src/main/resources/assets/skyblocker/lang/en_us.json | 17 |
2 files changed, 40 insertions, 11 deletions
diff --git a/src/main/java/de/hysky/skyblocker/skyblock/dwarven/CrystalsLocationsManager.java b/src/main/java/de/hysky/skyblocker/skyblock/dwarven/CrystalsLocationsManager.java index 0e3b4d59..5ab9dedd 100644 --- a/src/main/java/de/hysky/skyblocker/skyblock/dwarven/CrystalsLocationsManager.java +++ b/src/main/java/de/hysky/skyblocker/skyblock/dwarven/CrystalsLocationsManager.java @@ -21,6 +21,7 @@ import net.fabricmc.fabric.api.client.rendering.v1.WorldRenderEvents; import net.minecraft.client.MinecraftClient; import net.minecraft.command.CommandRegistryAccess; import net.minecraft.text.ClickEvent; +import net.minecraft.text.HoverEvent; import net.minecraft.text.MutableText; import net.minecraft.text.Text; import net.minecraft.util.Formatting; @@ -98,7 +99,7 @@ public class CrystalsLocationsManager { if (Arrays.stream(waypointLocation.toLowerCase().split(" ")).anyMatch(word -> userMessage.toLowerCase().contains(word))) { //check if contains a word of location //all data found to create waypoint //make sure the waypoint does not already exist in active waypoints, so waypoints can not get randomly moved - if (!activeWaypoints.containsKey(waypointLocation)){ + if (!activeWaypoints.containsKey(waypointLocation)) { addCustomWaypoint(waypointLocation, blockPos); } return; @@ -131,7 +132,7 @@ public class CrystalsLocationsManager { } } - protected static Boolean checkInCrystals(BlockPos pos) { + protected static boolean checkInCrystals(BlockPos pos) { //checks if a location is inside crystal hollows bounds return pos.getX() >= 202 && pos.getX() <= 823 && pos.getZ() >= 202 && pos.getZ() <= 823 @@ -200,7 +201,7 @@ public class CrystalsLocationsManager { * Creates a formated text with a list of possible places to add a waypoint for * * @param location the location where the waypoint will be created - * @param excludeUnknown if the "Unknown" location should be available to add + * @param excludeUnknown if the {@link de.hysky.skyblocker.skyblock.dwarven.MiningLocationLabel.CrystalHollowsLocationsCategory#UNKNOWN Unknown} location should be available to add * @return text for a message to send to the player */ private static Text getLocationMenu(String location, boolean excludeUnknown) { @@ -211,13 +212,23 @@ public class CrystalsLocationsManager { return text.append(Text.translatable("skyblocker.config.mining.crystalsWaypoints.allActive").formatted(Formatting.RED)); } + //add starting message + text.append(Text.translatable("skyblocker.config.mining.crystalsWaypoints.MarkLocation.start") + .append(Text.literal(" ("+location+") ").formatted(Formatting.GRAY)) + .append(Text.translatable("skyblocker.config.mining.crystalsWaypoints.MarkLocation.end")) + ); + + //add possible locations to the message for (String waypointLocation : WAYPOINT_LOCATIONS.keySet()) { //do not show option to add waypoints for existing locations or unknown if its disabled if (activeWaypoints.containsKey(waypointLocation) || (excludeUnknown && Objects.equals(waypointLocation, MiningLocationLabel.CrystalHollowsLocationsCategory.UNKNOWN.getName()))) { continue; } int locationColor = WAYPOINT_LOCATIONS.get(waypointLocation).getColor(); - text.append(Text.literal("[" + waypointLocation + "]").withColor(locationColor).styled(style -> style.withClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/skyblocker crystalWaypoints add " + location + " " + waypointLocation)))); + text.append(Text.literal("[" + waypointLocation + "]").withColor(locationColor).styled(style -> style + .withClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/skyblocker crystalWaypoints add " + location + " " + waypointLocation)) + .withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, Text.translatable("skyblocker.config.mining.crystalsWaypoints.getLocationHover.add").withColor(locationColor)))) + ); } return text; @@ -238,9 +249,22 @@ public class CrystalsLocationsManager { return text.append(Text.translatable("skyblocker.config.mining.crystalsWaypoints.noActive").formatted(Formatting.RED)); } + //depending on the action load the correct prefix and hover message + String hoverMessage; + if (action.equals("remove")) { + text.append(Text.translatable("skyblocker.config.mining.crystalsWaypoints.getLocationHover.remove").append(Text.literal(": "))); + hoverMessage = "skyblocker.config.mining.crystalsWaypoints.getLocationHover.remove"; + } else { + text.append(Text.translatable("skyblocker.config.mining.crystalsWaypoints.getLocationHover.share").append(Text.literal(": "))); + hoverMessage = "skyblocker.config.mining.crystalsWaypoints.getLocationHover.share"; + } + for (String waypointLocation : activeWaypoints.keySet()) { int locationColor = WAYPOINT_LOCATIONS.get(waypointLocation).getColor(); - text.append(Text.literal("[" + waypointLocation + "]").withColor(locationColor).styled(style -> style.withClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/skyblocker crystalWaypoints " + action + " " + waypointLocation)))); + text.append(Text.literal("[" + waypointLocation + "]").withColor(locationColor).styled(style -> style + .withClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/skyblocker crystalWaypoints " + action + " " + waypointLocation)) + .withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, Text.translatable(hoverMessage).withColor(locationColor)))) + ); } return text; diff --git a/src/main/resources/assets/skyblocker/lang/en_us.json b/src/main/resources/assets/skyblocker/lang/en_us.json index f323641a..97add21b 100644 --- a/src/main/resources/assets/skyblocker/lang/en_us.json +++ b/src/main/resources/assets/skyblocker/lang/en_us.json @@ -479,20 +479,25 @@ "skyblocker.config.mining.crystalsWaypoints.addedWaypoint.at": "at", "skyblocker.config.mining.crystalsWaypoints.noActive": "You have no active waypoints to share or remove.", "skyblocker.config.mining.crystalsWaypoints.allActive": "You have no more waypoints left to create.", + "skyblocker.config.mining.crystalsWaypoints.MarkLocation.start": "Mark", + "skyblocker.config.mining.crystalsWaypoints.MarkLocation.end": "as: ", + "skyblocker.config.mining.crystalsWaypoints.getLocationHover.add": "Add Location", + "skyblocker.config.mining.crystalsWaypoints.getLocationHover.remove": "Remove Location", + "skyblocker.config.mining.crystalsWaypoints.getLocationHover.share": "Share Location", "skyblocker.config.mining.crystalsWaypoints.shareFail": "Can only share waypoints you have found.", "skyblocker.config.mining.crystalsWaypoints.removeSuccess": "Removed waypoint for ", "skyblocker.config.mining.crystalsWaypoints.removeFail": "Can only remove waypoints you have found.", "skyblocker.config.mining.crystalsWaypoints.wishingCompassSolver": "Wishing Compass Solver", - "skyblocker.config.mining.crystalsWaypoints.wishingCompassSolver.@Tooltip": "Works out and adds a waypoint to where a wishing compass points to", - "skyblocker.config.mining.crystalsWaypoints.wishingCompassSolver.enableTabMessage": "Enable crystals in /tab so the compass can know what has been found", - "skyblocker.config.mining.crystalsWaypoints.wishingCompassSolver.wishingCompassUsedMessage": "Wishing compass used. Move to another location and use another compass to triangulate target", - "skyblocker.config.mining.crystalsWaypoints.wishingCompassSolver.somethingWentWrongMessage": "Something went wrong. lines do not cross. please try again", + "skyblocker.config.mining.crystalsWaypoints.wishingCompassSolver.@Tooltip": "Calculates and adds a waypoint at the location indicated by wishing compasses.", + "skyblocker.config.mining.crystalsWaypoints.wishingCompassSolver.enableTabMessage": "Enable crystals in the /tab to allow the compass to identify discovered items", + "skyblocker.config.mining.crystalsWaypoints.wishingCompassSolver.wishingCompassUsedMessage": "Wishing compass used. Move to another location and use a second compass to triangulate the target", + "skyblocker.config.mining.crystalsWaypoints.wishingCompassSolver.somethingWentWrongMessage": "The lines did not intersect (Something went wrong) please try again.", "skyblocker.config.mining.crystalsWaypoints.wishingCompassSolver.foundMessage": "Wishing compass solver found ", "skyblocker.config.mining.crystalsWaypoints.wishingCompassSolver.useOutsideNucleusMessage": "Use compass outside of nucleus for better results", "skyblocker.config.mining.crystalsWaypoints.wishingCompassSolver.moveFurtherMessage": "Move further away from the first use before using again", "skyblocker.config.mining.crystalsWaypoints.wishingCompassSolver.changingZoneMessage": "Changed zone. Restarting...", - "skyblocker.config.mining.crystalsWaypoints.wishingCompassSolver.waitLongerMessage": "Wait a little before using another wishing compass", - "skyblocker.config.mining.crystalsWaypoints.wishingCompassSolver.couldNotDetectLastUseMessage": "Could not detect last use. Restarting...", + "skyblocker.config.mining.crystalsWaypoints.wishingCompassSolver.waitLongerMessage": "Wait a moment before using another wishing compass", + "skyblocker.config.mining.crystalsWaypoints.wishingCompassSolver.couldNotDetectLastUseMessage": "Unable to detect the last use. Restarting...", "skyblocker.config.mining.dwarvenHud": "Dwarven HUD", "skyblocker.config.mining.dwarvenHud.enabledCommissions": "Enable Commissions", |