diff options
author | olim <bobq4582@gmail.com> | 2024-06-20 00:42:52 +0100 |
---|---|---|
committer | olim <bobq4582@gmail.com> | 2024-07-15 12:38:00 +0100 |
commit | c22843b1d2b34afe240df12d6129c980a0f6680c (patch) | |
tree | 0768f415b4710c08f47502e13dcdab6ea422fedb /src/main/java/de/hysky/skyblocker/skyblock/dwarven | |
parent | e30367c9b7b2370850e839e994d3c0bf95b3b9ad (diff) | |
download | Skyblocker-c22843b1d2b34afe240df12d6129c980a0f6680c.tar.gz Skyblocker-c22843b1d2b34afe240df12d6129c980a0f6680c.tar.bz2 Skyblocker-c22843b1d2b34afe240df12d6129c980a0f6680c.zip |
add options to config and translations
add option for wishing compass to config and translations for text in it. add separate scale for crystal waypoints and commissions
Diffstat (limited to 'src/main/java/de/hysky/skyblocker/skyblock/dwarven')
3 files changed, 17 insertions, 13 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 dd50e71e..3895d92d 100644 --- a/src/main/java/de/hysky/skyblocker/skyblock/dwarven/CrystalsLocationsManager.java +++ b/src/main/java/de/hysky/skyblocker/skyblock/dwarven/CrystalsLocationsManager.java @@ -116,7 +116,7 @@ public class CrystalsLocationsManager { } //move waypoint to be more accurate based on locational chat messages - if (CLIENT.player != null) { + if (CLIENT.player != null && SkyblockerConfigManager.get().mining.crystalsWaypoints.enabled) { for (MiningLocationLabel.CrystalHollowsLocationsCategory waypointLocation : WAYPOINT_LOCATIONS.values()) { String waypointLinkedMessage = waypointLocation.getLinkedMessage(); if (waypointLinkedMessage != null && text.contains(waypointLinkedMessage)) { diff --git a/src/main/java/de/hysky/skyblocker/skyblock/dwarven/MiningLocationLabel.java b/src/main/java/de/hysky/skyblocker/skyblock/dwarven/MiningLocationLabel.java index 964b6cce..2c3409c5 100644 --- a/src/main/java/de/hysky/skyblocker/skyblock/dwarven/MiningLocationLabel.java +++ b/src/main/java/de/hysky/skyblocker/skyblock/dwarven/MiningLocationLabel.java @@ -1,6 +1,7 @@ package de.hysky.skyblocker.skyblock.dwarven; import de.hysky.skyblocker.config.SkyblockerConfigManager; +import de.hysky.skyblocker.utils.Utils; import de.hysky.skyblocker.utils.render.RenderHelper; import de.hysky.skyblocker.utils.render.Renderable; import net.fabricmc.fabric.api.client.rendering.v1.WorldRenderContext; @@ -34,7 +35,9 @@ public record MiningLocationLabel(Category category, Vec3d centerPos) implements public void render(WorldRenderContext context) { Vec3d posUp = centerPos.add(0, 1, 0); double distance = context.camera().getPos().distanceTo(centerPos); - float scale = (float) (SkyblockerConfigManager.get().mining.commissionWaypoints.textScale * (distance / 10)); + //set scale config based on if in crystals or not + float textScale = Utils.isInCrystalHollows() ? SkyblockerConfigManager.get().mining.crystalsWaypoints.textScale : SkyblockerConfigManager.get().mining.commissionWaypoints.textScale; + float scale = (float) (textScale * (distance / 10)); RenderHelper.renderText(context, getName(), posUp, scale, true); RenderHelper.renderText(context, Text.literal(Math.round(distance) + "m").formatted(Formatting.YELLOW), posUp, scale, MinecraftClient.getInstance().textRenderer.fontHeight + 1, true); } diff --git a/src/main/java/de/hysky/skyblocker/skyblock/dwarven/WishingCompassSolver.java b/src/main/java/de/hysky/skyblocker/skyblock/dwarven/WishingCompassSolver.java index 930bdad8..7ba2e05a 100644 --- a/src/main/java/de/hysky/skyblocker/skyblock/dwarven/WishingCompassSolver.java +++ b/src/main/java/de/hysky/skyblocker/skyblock/dwarven/WishingCompassSolver.java @@ -1,5 +1,6 @@ package de.hysky.skyblocker.skyblock.dwarven; +import de.hysky.skyblocker.config.SkyblockerConfigManager; import de.hysky.skyblocker.skyblock.tabhud.util.PlayerListMgr; import de.hysky.skyblocker.utils.Constants; import de.hysky.skyblocker.utils.Utils; @@ -134,7 +135,7 @@ public class WishingCompassSolver { //make sure the data is in tab and if not tell the user if (displayNameStream.noneMatch(entry -> entry.equals("Crystals:"))) { - CLIENT.player.sendMessage(Constants.PREFIX.get().append(Text.literal("Enable crystals in /tab so the compass can know what has been found")), false); + CLIENT.player.sendMessage(Constants.PREFIX.get().append(Text.literal("skyblocker.config.mining.crystalsWaypoints.wishingCompassSolver.enableTabMessage")), false); return false; } @@ -188,7 +189,7 @@ public class WishingCompassSolver { if (particleUsedCountOne >= PARTICLES_PER_LINE) { currentState = SolverStates.WAITING_FOR_SECOND; if (CLIENT.player != null) { - CLIENT.player.sendMessage(Constants.PREFIX.get().append(Text.literal("Wishing compass used. Move to another location and use another compass to triangulate target").formatted(Formatting.GREEN)), false); + CLIENT.player.sendMessage(Constants.PREFIX.get().append(Text.translatable("skyblocker.config.mining.crystalsWaypoints.wishingCompassSolver.wishingCompassUsedMessage").formatted(Formatting.GREEN)), false); } } } @@ -212,7 +213,7 @@ public class WishingCompassSolver { } Vec3d targetLocation = solve(startPosOne, startPosTwo, directionOne, directionTwo); if (targetLocation == null) { - CLIENT.player.sendMessage(Constants.PREFIX.get().append(Text.literal("Something went wrong. lines do not cross. please try again").formatted(Formatting.RED)), false); + CLIENT.player.sendMessage(Constants.PREFIX.get().append(Text.translatable("skyblocker.config.mining.crystalsWaypoints.wishingCompassSolver.somethingWentWrongMessage").formatted(Formatting.RED)), false); } else { //send message to player with location and name MiningLocationLabel.CrystalHollowsLocationsCategory location = getTargetLocation(getZoneOfLocation(startPosOne)); @@ -222,7 +223,7 @@ public class WishingCompassSolver { } CLIENT.player.sendMessage(Constants.PREFIX.get() - .append(Text.literal("Wishing compass solver found ").formatted(Formatting.GREEN)) + .append(Text.translatable("skyblocker.config.mining.crystalsWaypoints.wishingCompassSolver.foundMessage").formatted(Formatting.GREEN)) .append(Text.literal(location.getName()).withColor(location.getColor())) .append(Text.literal(": " + (int) targetLocation.getX() + " " + (int) targetLocation.getY() + " " + (int) targetLocation.getZ())), false); @@ -262,7 +263,7 @@ public class WishingCompassSolver { } ItemStack stack = CLIENT.player.getStackInHand(hand); //make sure the user is in the crystal hollows and holding the wishing compass - if (!Utils.isInCrystalHollows() || !Objects.equals(stack.getSkyblockId(), "WISHING_COMPASS")) { + if (!Utils.isInCrystalHollows() || !SkyblockerConfigManager.get().mining.crystalsWaypoints.WishingCompassSolver || !Objects.equals(stack.getSkyblockId(), "WISHING_COMPASS")) { return ActionResult.PASS; } if (useCompass()) { @@ -278,7 +279,7 @@ public class WishingCompassSolver { } ItemStack stack = CLIENT.player.getStackInHand(hand); //make sure the user is in the crystal hollows and holding the wishing compass - if (!Utils.isInCrystalHollows() || !Objects.equals(stack.getSkyblockId(), "WISHING_COMPASS")) { + if (!Utils.isInCrystalHollows() || !SkyblockerConfigManager.get().mining.crystalsWaypoints.WishingCompassSolver || !Objects.equals(stack.getSkyblockId(), "WISHING_COMPASS")) { return TypedActionResult.pass(stack); } if (useCompass()) { @@ -304,7 +305,7 @@ public class WishingCompassSolver { case NOT_STARTED -> { //do not start if the player is in nucleus as this does not work well if (currentZone == ZONE.CRYSTAL_NUCLEUS) { - CLIENT.player.sendMessage(Constants.PREFIX.get().append(Text.literal("Use compass outside of nucleus for better results")), false); + CLIENT.player.sendMessage(Constants.PREFIX.get().append(Text.translatable("skyblocker.config.mining.crystalsWaypoints.wishingCompassSolver.useOutsideNucleusMessage")), false); return true; } startNewState(SolverStates.PROCESSING_FIRST_USE); @@ -313,12 +314,12 @@ public class WishingCompassSolver { case WAITING_FOR_SECOND -> { //only continue if the player is far enough away from the first position to get a better reading if (startPosOne.distanceTo(playerPos) < DISTANCE_BETWEEN_USES) { - CLIENT.player.sendMessage(Constants.PREFIX.get().append(Text.literal("Move further away from the first use before using again")), false); + CLIENT.player.sendMessage(Constants.PREFIX.get().append(Text.translatable("skyblocker.config.mining.crystalsWaypoints.wishingCompassSolver.moveFurtherMessage")), false); return true; } else { //make sure the player is in the same zone as they used to first or restart if (currentZone != getZoneOfLocation(startPosOne)) { - CLIENT.player.sendMessage(Constants.PREFIX.get().append(Text.literal("Changed zone. Restarting...")), false); + CLIENT.player.sendMessage(Constants.PREFIX.get().append(Text.translatable("skyblocker.config.mining.crystalsWaypoints.wishingCompassSolver.changingZoneMessage")), false); startNewState(SolverStates.PROCESSING_FIRST_USE); } else { startNewState(SolverStates.PROCESSING_SECOND_USE); @@ -330,10 +331,10 @@ public class WishingCompassSolver { //if still looking for particles for line tell the user to wait //else tell the use something went wrong and its starting again if (System.currentTimeMillis() - particleLastUpdate < PARTICLES_MAX_DELAY) { - CLIENT.player.sendMessage(Constants.PREFIX.get().append(Text.literal("Wait a little before using another wishing compass").formatted(Formatting.RED)), false); + CLIENT.player.sendMessage(Constants.PREFIX.get().append(Text.translatable("skyblocker.config.mining.crystalsWaypoints.wishingCompassSolver.waitLongerMessage").formatted(Formatting.RED)), false); return true; } else { - CLIENT.player.sendMessage(Constants.PREFIX.get().append(Text.literal("Could not detect last use. Restarting...").formatted(Formatting.RED)), false); + CLIENT.player.sendMessage(Constants.PREFIX.get().append(Text.translatable("skyblocker.config.mining.crystalsWaypoints.wishingCompassSolver.couldNotDetectLastUseMessage").formatted(Formatting.RED)), false); startNewState(SolverStates.PROCESSING_FIRST_USE); } } |