From 4598f8d038c091e4158dc7b1dbbcb7cdd5f0d5a7 Mon Sep 17 00:00:00 2001 From: olim Date: Tue, 16 Apr 2024 21:32:01 +0100 Subject: main commit most of the feature is implemented with some optimisations and fixes for y offsets still needed --- .../java/de/hysky/skyblocker/SkyblockerMod.java | 2 + .../hysky/skyblocker/config/SkyblockerConfig.java | 3 + .../config/categories/DwarvenMinesCategory.java | 7 + .../skyblocker/skyblock/dwarven/MetalDetector.java | 235 +++++++++++++++++++++ 4 files changed, 247 insertions(+) create mode 100644 src/main/java/de/hysky/skyblocker/skyblock/dwarven/MetalDetector.java (limited to 'src/main/java/de/hysky') diff --git a/src/main/java/de/hysky/skyblocker/SkyblockerMod.java b/src/main/java/de/hysky/skyblocker/SkyblockerMod.java index 3d96cc50..494b16e2 100644 --- a/src/main/java/de/hysky/skyblocker/SkyblockerMod.java +++ b/src/main/java/de/hysky/skyblocker/SkyblockerMod.java @@ -20,6 +20,7 @@ import de.hysky.skyblocker.skyblock.dungeon.secrets.SecretsTracker; import de.hysky.skyblocker.skyblock.dwarven.CrystalsHud; import de.hysky.skyblocker.skyblock.dwarven.CrystalsLocationsManager; import de.hysky.skyblocker.skyblock.dwarven.DwarvenHud; +import de.hysky.skyblocker.skyblock.dwarven.MetalDetector; import de.hysky.skyblocker.skyblock.end.BeaconHighlighter; import de.hysky.skyblocker.skyblock.end.EnderNodes; import de.hysky.skyblocker.skyblock.end.TheEnd; @@ -123,6 +124,7 @@ public class SkyblockerMod implements ClientModInitializer { FarmingHud.init(); LowerSensitivity.init(); CrystalsLocationsManager.init(); + MetalDetector.init(); ChatMessageListener.init(); Shortcuts.init(); ChatRulesHandler.init(); diff --git a/src/main/java/de/hysky/skyblocker/config/SkyblockerConfig.java b/src/main/java/de/hysky/skyblocker/config/SkyblockerConfig.java index a1e1dadc..7653dc0c 100644 --- a/src/main/java/de/hysky/skyblocker/config/SkyblockerConfig.java +++ b/src/main/java/de/hysky/skyblocker/config/SkyblockerConfig.java @@ -937,6 +937,9 @@ public class SkyblockerConfig { @SerialEntry public boolean solvePuzzler = true; + @SerialEntry + public boolean MetalDetectorHelper = true; + @SerialEntry public DwarvenHud dwarvenHud = new DwarvenHud(); diff --git a/src/main/java/de/hysky/skyblocker/config/categories/DwarvenMinesCategory.java b/src/main/java/de/hysky/skyblocker/config/categories/DwarvenMinesCategory.java index 4ae0fc35..669639ef 100644 --- a/src/main/java/de/hysky/skyblocker/config/categories/DwarvenMinesCategory.java +++ b/src/main/java/de/hysky/skyblocker/config/categories/DwarvenMinesCategory.java @@ -42,6 +42,13 @@ public class DwarvenMinesCategory { newValue -> config.locations.dwarvenMines.solvePuzzler = newValue) .controller(ConfigUtils::createBooleanController) .build()) + .option(Option.createBuilder() + .name(Text.translatable("text.autoconfig.skyblocker.option.locations.dwarvenMines.MetalDetectorHelper")) + .binding(defaults.locations.dwarvenMines.MetalDetectorHelper, + () -> config.locations.dwarvenMines.MetalDetectorHelper, + newValue -> config.locations.dwarvenMines.MetalDetectorHelper = newValue) + .controller(ConfigUtils::createBooleanController) + .build()) //Dwarven HUD .group(OptionGroup.createBuilder() diff --git a/src/main/java/de/hysky/skyblocker/skyblock/dwarven/MetalDetector.java b/src/main/java/de/hysky/skyblocker/skyblock/dwarven/MetalDetector.java new file mode 100644 index 00000000..cf10efe1 --- /dev/null +++ b/src/main/java/de/hysky/skyblocker/skyblock/dwarven/MetalDetector.java @@ -0,0 +1,235 @@ +package de.hysky.skyblocker.skyblock.dwarven; + +import de.hysky.skyblocker.config.SkyblockerConfigManager; +import de.hysky.skyblocker.skyblock.dungeon.GuardianHealth; +import de.hysky.skyblocker.utils.Constants; +import de.hysky.skyblocker.utils.Utils; +import de.hysky.skyblocker.utils.render.RenderHelper; +import de.hysky.skyblocker.utils.waypoint.Waypoint; +import net.fabricmc.fabric.api.client.message.v1.ClientReceiveMessageEvents; +import net.fabricmc.fabric.api.client.rendering.v1.WorldRenderContext; +import net.fabricmc.fabric.api.client.rendering.v1.WorldRenderEvents; +import net.minecraft.client.MinecraftClient; +import net.minecraft.entity.decoration.ArmorStandEntity; +import net.minecraft.text.Text; +import net.minecraft.util.Formatting; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.Box; +import net.minecraft.util.math.Vec3d; +import net.minecraft.util.math.Vec3i; + +import java.awt.*; +import java.util.*; +import java.util.List; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +public class MetalDetector { + + private static final MinecraftClient CLIENT = MinecraftClient.getInstance(); + + private static final float[] LIGHT_GRAY = { 192 / 255f, 192 / 255f, 192 / 255f }; + + private static final Pattern TREASURE_PATTERN = Pattern.compile("(§3§lTREASURE: §b)(\\d+\\.\\d)m"); + + private static final Pattern KEEPER_PATTERN = Pattern.compile("Keeper of (\\w+)"); + private static final HashMap keeperOffsets = new HashMap() {{ + put("Diamond", new Vec3i(33, 0, 3)); + put("Lapis", new Vec3i(-33, 0, -3)); + put("Emerald", new Vec3i(-3, 0, 33)); + put("Gold", new Vec3i(3, 0, -33)); + }}; + + private static final HashSet knownChestOffsets = new HashSet<>(Arrays.asList( + new Vec3i(-38, -22, 26), // -38, -22, 26 + new Vec3i(38, -22, -26), // 38, -22, -26 + new Vec3i(-40, -22, 18), // -40, -22, 18 + new Vec3i(-41, -20, 22), // -41, -20, 22 + new Vec3i(-5, -21, 16), // -5, -21, 16 + new Vec3i(40, -22, -30), // 40, -22, -30 + new Vec3i(-42, -20, -28), // -42, -20, -28 + new Vec3i(-43, -22, -40), // -43, -22, -40 + new Vec3i(42, -19, -41), // 42, -19, -41 + new Vec3i(43, -21, -16), // 43, -21, -16 + new Vec3i(-1, -22, -20), // -1, -22, -20 + new Vec3i(6, -21, 28), // 6, -21, 28 + new Vec3i(7, -21, 11), // 7, -21, 11 + new Vec3i(7, -21, 22), // 7, -21, 22 + new Vec3i(-12, -21, -44), // -12, -21, -44 + new Vec3i(12, -22, 31), // 12, -22, 31 + new Vec3i(12, -22, -22), // 12, -22, -22 + new Vec3i(12, -21, 7), // 12, -21, 7 + new Vec3i(12, -21, -43), // 12, -21, -43 + new Vec3i(-14, -21, 43), // -14, -21, 43 + new Vec3i(-14, -21, 22), // -14, -21, 22 + new Vec3i(-17, -21, 20), // -17, -21, 20 + new Vec3i(-20, -22, 0), // -20, -22, 0 + new Vec3i(1, -21, 20), // 1, -21, 20 + new Vec3i(19, -22, 29), // 19, -22, 29 + new Vec3i(20, -22, 0), // 20, -22, 0 + new Vec3i(20, -21, -26), // 20, -21, -26 + new Vec3i(-23, -22, 40), // -23, -22, 40 + new Vec3i(22, -21, -14), // 22, -21, -14 + new Vec3i(-24, -22, 12), // -24, -22, 12 + new Vec3i(23, -22, 26), // 23, -22, 26 + new Vec3i(23, -22, -39), // 23, -22, -39 + new Vec3i(24, -22, 27), // 24, -22, 27 + new Vec3i(25, -22, 17), // 25, -22, 17 + new Vec3i(29, -21, -44), // 29, -21, -44 + new Vec3i(-31, -21, -12), // -31, -21, -12 + new Vec3i(-31, -21, -40), // -31, -21, -40 + new Vec3i(30, -21, -25), // 30, -21, -25 + new Vec3i(-32, -21, -40), // -32, -21, -40 + new Vec3i(-36, -20, 42), // -36, -20, 42 + new Vec3i(-37, -21, -14), // -37, -21, -14 + new Vec3i(-37, -21, -22) // -37, -21, -22 + )); + + private static Vec3i minesCenter = null; + private static double previousDistance; + private static Vec3d previousPlayerPos; + private static boolean newTreasure = true; + + private static boolean startedLooking = false; + + private static List possibleBlocks = new ArrayList<>(); + + public static void init() { + ClientReceiveMessageEvents.GAME.register(MetalDetector::getDistanceMessage); + WorldRenderEvents.AFTER_TRANSLUCENT.register(MetalDetector::render); + } + + private static void getDistanceMessage(Text text, boolean overlay) { + if (!overlay || !SkyblockerConfigManager.get().locations.dwarvenMines.MetalDetectorHelper || !Utils.isInCrystalHollows() || !(Utils.getIslandArea().substring(2).equals("Mines of Divan")) || CLIENT.player == null) { + checkChestFound(text); + return; + } + //in the mines of divan + Matcher treasureDistanceMature = TREASURE_PATTERN.matcher(text.getString()); + if (!treasureDistanceMature.matches()) { + return; + } + //using the metal detector + double distance = Double.parseDouble(treasureDistanceMature.group(2)); + Vec3d playerPos = CLIENT.player.getPos(); + int previousPossibleBlockCount = possibleBlocks.size(); + + //send message when starting looking about how to use mod + if (!startedLooking) { + startedLooking = true; + CLIENT.player.sendMessage(Constants.PREFIX.get().append(Text.translatable("text.autoconfig.skyblocker.option.locations.dwarvenMines.solveMetalDetector.startTip")),false); + } + + //find the center of the mines if possible to speed up search + if (minesCenter == null) { + findCenterOfMines(); + } + + //find the possible locations the treasure could be + if (distance == previousDistance && playerPos == previousPlayerPos) { + updatePossibleBlocks(distance, playerPos); + } + + //if the amount of possible blocks has changed output that to the user + if (possibleBlocks.size() != previousPossibleBlockCount) { + if (possibleBlocks.size() == 1) { + CLIENT.player.sendMessage(Constants.PREFIX.get().append(Text.translatable("text.autoconfig.skyblocker.option.locations.dwarvenMines.solveMetalDetector.foundTreasureMessage").formatted(Formatting.GREEN)),false); + } + else { + CLIENT.player.sendMessage(Constants.PREFIX.get().append(Text.translatable("text.autoconfig.skyblocker.option.locations.dwarvenMines.solveMetalDetector.possibleTreasureLocationsMessage").append(Text.of(String.valueOf(possibleBlocks.size())))),false); + } + } + + + //update previous positions + previousDistance = distance; + previousPlayerPos = playerPos; + } + + private static void checkChestFound(Text text) { + if (!Utils.isInCrystalHollows() || !(Utils.getIslandArea().substring(2).equals("Mines of Divan")) || CLIENT.player == null) { + return; + } + if (text.getString().startsWith("You found")) { + newTreasure = true; + possibleBlocks = new ArrayList<>(); + } + } + + private static void updatePossibleBlocks(Double distance, Vec3d playerPos) { + if (newTreasure) { + possibleBlocks = new ArrayList<>(); + newTreasure = false; + for (int x = -distance.intValue(); x < distance; x++) { + for (int z = -distance.intValue(); z < distance; z++) { + Vec3i checkPos =new Vec3i((int)(playerPos.x) + x, (int)playerPos.y, (int)playerPos.z + z); + //System.out.println("checking starting block: "+ Math.round(playerPos.distanceTo(checkPos) - distance)); + if (Math.abs(playerPos.distanceTo(Vec3d.of(checkPos)) - distance) < 0.25) { + if (minesCenter != null) {//if center of the mines is known use the predefined offsets to filter the locations + for (Vec3i knownOffset : knownChestOffsets) { + if (minesCenter.add(knownOffset).getX() == checkPos.getX() && minesCenter.add(knownOffset).getZ() == checkPos.getZ()) { + possibleBlocks.add(minesCenter.add(knownOffset)); //only add known locations + } + } + } + else { + possibleBlocks.add(checkPos); + } + } + } + } + } else { + possibleBlocks.removeIf(location -> Math.abs(playerPos.distanceTo(Vec3d.of(location)) - distance) >= 0.25); + } + + //if possible blocks is of length 0 something has failed reset and try again + if (possibleBlocks.isEmpty()) { + newTreasure = true; + if (CLIENT.player != null) { + CLIENT.player.sendMessage(Constants.PREFIX.get().append(Text.translatable("text.autoconfig.skyblocker.option.locations.dwarvenMines.solveMetalDetector.somethingWentWrongMessage").formatted(Formatting.RED)),false); + System.out.println(minesCenter); + } + } + } + + private static void findCenterOfMines() { + if (CLIENT.player == null || CLIENT.world == null) { + return; + } + Box searchBox = CLIENT.player.getBoundingBox().expand(500d); + List armorStands = CLIENT.world.getEntitiesByClass(ArmorStandEntity.class, searchBox, ArmorStandEntity::hasCustomName); + + for (ArmorStandEntity armorStand : armorStands) { + String name = armorStand.getName().getString(); + Matcher nameMatcher = KEEPER_PATTERN.matcher(name); + + if (nameMatcher.matches()) { + Vec3i offset = keeperOffsets.get(nameMatcher.group(1)); + minesCenter = armorStand.getBlockPos().add(offset); + CLIENT.player.sendMessage(Constants.PREFIX.get().append(Text.translatable("text.autoconfig.skyblocker.option.locations.dwarvenMines.solveMetalDetector.foundCenter").formatted(Formatting.GREEN)),false); + return; + } + } + } + + private static void render(WorldRenderContext context) { + //only render enabled and if there is a few location options and in the mines of divan + if (!SkyblockerConfigManager.get().locations.dwarvenMines.MetalDetectorHelper || possibleBlocks.isEmpty() || possibleBlocks.size() > 8 || !(Utils.getIslandArea().substring(2).equals("Mines of Divan"))) { + return; + } + //only one location render just that and guiding line to it + if (possibleBlocks.size() == 1) { + Vec3i block = possibleBlocks.get(0); + CrystalsWaypoint waypoint = new CrystalsWaypoint(CrystalsWaypoint.Category.MINES_OF_DIVAN, Text.translatable("text.autoconfig.skyblocker.option.locations.dwarvenMines.solveMetalDetector.treasure"), new BlockPos(block.getX(), block.getY(), block.getZ())); + waypoint.render(context); + RenderHelper.renderLineFromCursor(context, Vec3d.ofCenter(block), LIGHT_GRAY, 1f, 5f); + return; + } + + for (Vec3i block : possibleBlocks) { + CrystalsWaypoint waypoint = new CrystalsWaypoint(CrystalsWaypoint.Category.MINES_OF_DIVAN, Text.translatable("text.autoconfig.skyblocker.option.locations.dwarvenMines.solveMetalDetector.possible"), new BlockPos(block.getX(), block.getY(), block.getZ())); + waypoint.render(context); + } + + } +} -- cgit From 3e28335ed2909cdb1a0a5952b170a3dd25f160d2 Mon Sep 17 00:00:00 2001 From: olim Date: Wed, 17 Apr 2024 12:27:53 +0100 Subject: optimise and clean up code --- .../skyblocker/skyblock/dwarven/MetalDetector.java | 54 ++++++++++------------ .../resources/assets/skyblocker/lang/en_us.json | 18 ++++---- 2 files changed, 33 insertions(+), 39 deletions(-) (limited to 'src/main/java/de/hysky') diff --git a/src/main/java/de/hysky/skyblocker/skyblock/dwarven/MetalDetector.java b/src/main/java/de/hysky/skyblocker/skyblock/dwarven/MetalDetector.java index cf10efe1..203e1880 100644 --- a/src/main/java/de/hysky/skyblocker/skyblock/dwarven/MetalDetector.java +++ b/src/main/java/de/hysky/skyblocker/skyblock/dwarven/MetalDetector.java @@ -1,11 +1,9 @@ package de.hysky.skyblocker.skyblock.dwarven; import de.hysky.skyblocker.config.SkyblockerConfigManager; -import de.hysky.skyblocker.skyblock.dungeon.GuardianHealth; import de.hysky.skyblocker.utils.Constants; import de.hysky.skyblocker.utils.Utils; import de.hysky.skyblocker.utils.render.RenderHelper; -import de.hysky.skyblocker.utils.waypoint.Waypoint; import net.fabricmc.fabric.api.client.message.v1.ClientReceiveMessageEvents; import net.fabricmc.fabric.api.client.rendering.v1.WorldRenderContext; import net.fabricmc.fabric.api.client.rendering.v1.WorldRenderEvents; @@ -18,9 +16,7 @@ import net.minecraft.util.math.Box; import net.minecraft.util.math.Vec3d; import net.minecraft.util.math.Vec3i; -import java.awt.*; import java.util.*; -import java.util.List; import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -33,7 +29,7 @@ public class MetalDetector { private static final Pattern TREASURE_PATTERN = Pattern.compile("(§3§lTREASURE: §b)(\\d+\\.\\d)m"); private static final Pattern KEEPER_PATTERN = Pattern.compile("Keeper of (\\w+)"); - private static final HashMap keeperOffsets = new HashMap() {{ + private static final HashMap keeperOffsets = new HashMap<>() {{ put("Diamond", new Vec3i(33, 0, 3)); put("Lapis", new Vec3i(-33, 0, -3)); put("Emerald", new Vec3i(-3, 0, 33)); @@ -109,7 +105,7 @@ public class MetalDetector { if (!treasureDistanceMature.matches()) { return; } - //using the metal detector + //find new values double distance = Double.parseDouble(treasureDistanceMature.group(2)); Vec3d playerPos = CLIENT.player.getPos(); int previousPossibleBlockCount = possibleBlocks.size(); @@ -117,7 +113,7 @@ public class MetalDetector { //send message when starting looking about how to use mod if (!startedLooking) { startedLooking = true; - CLIENT.player.sendMessage(Constants.PREFIX.get().append(Text.translatable("text.autoconfig.skyblocker.option.locations.dwarvenMines.solveMetalDetector.startTip")),false); + CLIENT.player.sendMessage(Constants.PREFIX.get().append(Text.translatable("text.autoconfig.skyblocker.option.locations.dwarvenMines.MetalDetectorHelper.startTip")),false); } //find the center of the mines if possible to speed up search @@ -126,21 +122,20 @@ public class MetalDetector { } //find the possible locations the treasure could be - if (distance == previousDistance && playerPos == previousPlayerPos) { + if (distance == previousDistance && playerPos.equals(previousPlayerPos)) { updatePossibleBlocks(distance, playerPos); } //if the amount of possible blocks has changed output that to the user if (possibleBlocks.size() != previousPossibleBlockCount) { if (possibleBlocks.size() == 1) { - CLIENT.player.sendMessage(Constants.PREFIX.get().append(Text.translatable("text.autoconfig.skyblocker.option.locations.dwarvenMines.solveMetalDetector.foundTreasureMessage").formatted(Formatting.GREEN)),false); + CLIENT.player.sendMessage(Constants.PREFIX.get().append(Text.translatable("text.autoconfig.skyblocker.option.locations.dwarvenMines.MetalDetectorHelper.foundTreasureMessage").formatted(Formatting.GREEN)),false); } else { - CLIENT.player.sendMessage(Constants.PREFIX.get().append(Text.translatable("text.autoconfig.skyblocker.option.locations.dwarvenMines.solveMetalDetector.possibleTreasureLocationsMessage").append(Text.of(String.valueOf(possibleBlocks.size())))),false); + CLIENT.player.sendMessage(Constants.PREFIX.get().append(Text.translatable("text.autoconfig.skyblocker.option.locations.dwarvenMines.MetalDetectorHelper.possibleTreasureLocationsMessage").append(Text.of(String.valueOf(possibleBlocks.size())))),false); } } - //update previous positions previousDistance = distance; previousPlayerPos = playerPos; @@ -160,24 +155,25 @@ public class MetalDetector { if (newTreasure) { possibleBlocks = new ArrayList<>(); newTreasure = false; - for (int x = -distance.intValue(); x < distance; x++) { - for (int z = -distance.intValue(); z < distance; z++) { - Vec3i checkPos =new Vec3i((int)(playerPos.x) + x, (int)playerPos.y, (int)playerPos.z + z); - //System.out.println("checking starting block: "+ Math.round(playerPos.distanceTo(checkPos) - distance)); + if (minesCenter != null) {//if center of the mines is known use the predefined offsets to filter the locations + for (Vec3i knownOffset : knownChestOffsets) { + Vec3i checkPos = minesCenter.add(knownOffset).add(0,1,0); if (Math.abs(playerPos.distanceTo(Vec3d.of(checkPos)) - distance) < 0.25) { - if (minesCenter != null) {//if center of the mines is known use the predefined offsets to filter the locations - for (Vec3i knownOffset : knownChestOffsets) { - if (minesCenter.add(knownOffset).getX() == checkPos.getX() && minesCenter.add(knownOffset).getZ() == checkPos.getZ()) { - possibleBlocks.add(minesCenter.add(knownOffset)); //only add known locations - } - } - } - else { + possibleBlocks.add(checkPos); + } + } + } + else { + for (int x = -distance.intValue(); x < distance; x++) { + for (int z = -distance.intValue(); z < distance; z++) { + Vec3i checkPos =new Vec3i((int)(playerPos.x) + x, (int)playerPos.y, (int)playerPos.z + z); + if (Math.abs(playerPos.distanceTo(Vec3d.of(checkPos)) - distance) < 0.25) { possibleBlocks.add(checkPos); } } } } + } else { possibleBlocks.removeIf(location -> Math.abs(playerPos.distanceTo(Vec3d.of(location)) - distance) >= 0.25); } @@ -186,8 +182,7 @@ public class MetalDetector { if (possibleBlocks.isEmpty()) { newTreasure = true; if (CLIENT.player != null) { - CLIENT.player.sendMessage(Constants.PREFIX.get().append(Text.translatable("text.autoconfig.skyblocker.option.locations.dwarvenMines.solveMetalDetector.somethingWentWrongMessage").formatted(Formatting.RED)),false); - System.out.println(minesCenter); + CLIENT.player.sendMessage(Constants.PREFIX.get().append(Text.translatable("text.autoconfig.skyblocker.option.locations.dwarvenMines.MetalDetectorHelper.somethingWentWrongMessage").formatted(Formatting.RED)),false); } } } @@ -206,7 +201,7 @@ public class MetalDetector { if (nameMatcher.matches()) { Vec3i offset = keeperOffsets.get(nameMatcher.group(1)); minesCenter = armorStand.getBlockPos().add(offset); - CLIENT.player.sendMessage(Constants.PREFIX.get().append(Text.translatable("text.autoconfig.skyblocker.option.locations.dwarvenMines.solveMetalDetector.foundCenter").formatted(Formatting.GREEN)),false); + CLIENT.player.sendMessage(Constants.PREFIX.get().append(Text.translatable("text.autoconfig.skyblocker.option.locations.dwarvenMines.MetalDetectorHelper.foundCenter").formatted(Formatting.GREEN)),false); return; } } @@ -219,17 +214,16 @@ public class MetalDetector { } //only one location render just that and guiding line to it if (possibleBlocks.size() == 1) { - Vec3i block = possibleBlocks.get(0); - CrystalsWaypoint waypoint = new CrystalsWaypoint(CrystalsWaypoint.Category.MINES_OF_DIVAN, Text.translatable("text.autoconfig.skyblocker.option.locations.dwarvenMines.solveMetalDetector.treasure"), new BlockPos(block.getX(), block.getY(), block.getZ())); + Vec3i block = possibleBlocks.get(0).add(0, -1, 0); //the block you are taken to is one block above the chest + CrystalsWaypoint waypoint = new CrystalsWaypoint(CrystalsWaypoint.Category.MINES_OF_DIVAN, Text.translatable("text.autoconfig.skyblocker.option.locations.dwarvenMines.MetalDetectorHelper.treasure"), new BlockPos(block.getX(), block.getY(), block.getZ())); waypoint.render(context); RenderHelper.renderLineFromCursor(context, Vec3d.ofCenter(block), LIGHT_GRAY, 1f, 5f); return; } for (Vec3i block : possibleBlocks) { - CrystalsWaypoint waypoint = new CrystalsWaypoint(CrystalsWaypoint.Category.MINES_OF_DIVAN, Text.translatable("text.autoconfig.skyblocker.option.locations.dwarvenMines.solveMetalDetector.possible"), new BlockPos(block.getX(), block.getY(), block.getZ())); + CrystalsWaypoint waypoint = new CrystalsWaypoint(CrystalsWaypoint.Category.MINES_OF_DIVAN, Text.translatable("text.autoconfig.skyblocker.option.locations.dwarvenMines.MetalDetectorHelper.possible"), new BlockPos(block.getX(), block.getY(), block.getZ())); waypoint.render(context); } - } } diff --git a/src/main/resources/assets/skyblocker/lang/en_us.json b/src/main/resources/assets/skyblocker/lang/en_us.json index e859db04..4300432d 100644 --- a/src/main/resources/assets/skyblocker/lang/en_us.json +++ b/src/main/resources/assets/skyblocker/lang/en_us.json @@ -333,15 +333,15 @@ "text.autoconfig.skyblocker.option.locations.dwarvenMines.enableDrillFuel": "Enable Drill Fuel", "text.autoconfig.skyblocker.option.locations.dwarvenMines.solveFetchur": "Solve Fetchur", "text.autoconfig.skyblocker.option.locations.dwarvenMines.solvePuzzler": "Solve Puzzler Puzzle", - "text.autoconfig.skyblocker.option.locations.dwarvenMines.solveMetalDetector": "Metal Detector Helper", - "text.autoconfig.skyblocker.option.locations.dwarvenMines.solveMetalDetector.@Tooltip": "Helper for the metal detector puzzle in the Mines of Divan in the Crystal Hollows.", - "text.autoconfig.skyblocker.option.locations.dwarvenMines.solveMetalDetector.startTip": "Stand still in multiple places unit solver has narrowed down locations to one", - "text.autoconfig.skyblocker.option.locations.dwarvenMines.solveMetalDetector.foundCenter": "Found center of mines now working faster", - "text.autoconfig.skyblocker.option.locations.dwarvenMines.solveMetalDetector.foundTreasureMessage": "Found treasure", - "text.autoconfig.skyblocker.option.locations.dwarvenMines.solveMetalDetector.possibleTreasureLocationsMessage": "Possible treasure locations: ", - "text.autoconfig.skyblocker.option.locations.dwarvenMines.solveMetalDetector.somethingWentWrongMessage": "Something went wrong with the metal detector. Trying again", - "text.autoconfig.skyblocker.option.locations.dwarvenMines.solveMetalDetector.treasure": "Treasure", - "text.autoconfig.skyblocker.option.locations.dwarvenMines.solveMetalDetector.possible": "Possible", + "text.autoconfig.skyblocker.option.locations.dwarvenMines.MetalDetectorHelper": "Metal Detector Helper", + "text.autoconfig.skyblocker.option.locations.dwarvenMines.MetalDetectorHelper.@Tooltip": "Helper for the metal detector puzzle in the Mines of Divan in the Crystal Hollows.", + "text.autoconfig.skyblocker.option.locations.dwarvenMines.MetalDetectorHelper.startTip": "Stand still in multiple places unit solver has narrowed down locations to one", + "text.autoconfig.skyblocker.option.locations.dwarvenMines.MetalDetectorHelper.foundCenter": "Found center of mines now working faster", + "text.autoconfig.skyblocker.option.locations.dwarvenMines.MetalDetectorHelper.foundTreasureMessage": "Found treasure", + "text.autoconfig.skyblocker.option.locations.dwarvenMines.MetalDetectorHelper.possibleTreasureLocationsMessage": "Possible treasure locations: ", + "text.autoconfig.skyblocker.option.locations.dwarvenMines.MetalDetectorHelper.somethingWentWrongMessage": "Something went wrong with the metal detector. Trying again", + "text.autoconfig.skyblocker.option.locations.dwarvenMines.MetalDetectorHelper.treasure": "Treasure", + "text.autoconfig.skyblocker.option.locations.dwarvenMines.MetalDetectorHelper.possible": "Possible", "text.autoconfig.skyblocker.option.locations.dwarvenMines.dwarvenHud": "Dwarven HUD", "text.autoconfig.skyblocker.option.locations.dwarvenMines.dwarvenHud.enabledCommissions": "Enable Commissions", "text.autoconfig.skyblocker.option.locations.dwarvenMines.dwarvenHud.enabledPowder": "Enable Powder", -- cgit From 31744be3393f3fcec57dccfbc4aa8a1942c08f15 Mon Sep 17 00:00:00 2001 From: olim Date: Wed, 17 Apr 2024 12:32:12 +0100 Subject: fix option description --- .../de/hysky/skyblocker/config/categories/DwarvenMinesCategory.java | 2 +- src/main/resources/assets/skyblocker/lang/en_us.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'src/main/java/de/hysky') diff --git a/src/main/java/de/hysky/skyblocker/config/categories/DwarvenMinesCategory.java b/src/main/java/de/hysky/skyblocker/config/categories/DwarvenMinesCategory.java index 669639ef..67b8632b 100644 --- a/src/main/java/de/hysky/skyblocker/config/categories/DwarvenMinesCategory.java +++ b/src/main/java/de/hysky/skyblocker/config/categories/DwarvenMinesCategory.java @@ -44,7 +44,7 @@ public class DwarvenMinesCategory { .build()) .option(Option.createBuilder() .name(Text.translatable("text.autoconfig.skyblocker.option.locations.dwarvenMines.MetalDetectorHelper")) - .binding(defaults.locations.dwarvenMines.MetalDetectorHelper, + .description(OptionDescription.of(Text.translatable("text.autoconfig.skyblocker.option.locations.dwarvenMines.MetalDetectorHelper.@Tooltip"))) .binding(defaults.locations.dwarvenMines.MetalDetectorHelper, () -> config.locations.dwarvenMines.MetalDetectorHelper, newValue -> config.locations.dwarvenMines.MetalDetectorHelper = newValue) .controller(ConfigUtils::createBooleanController) diff --git a/src/main/resources/assets/skyblocker/lang/en_us.json b/src/main/resources/assets/skyblocker/lang/en_us.json index 4300432d..ee4a77b1 100644 --- a/src/main/resources/assets/skyblocker/lang/en_us.json +++ b/src/main/resources/assets/skyblocker/lang/en_us.json @@ -334,7 +334,7 @@ "text.autoconfig.skyblocker.option.locations.dwarvenMines.solveFetchur": "Solve Fetchur", "text.autoconfig.skyblocker.option.locations.dwarvenMines.solvePuzzler": "Solve Puzzler Puzzle", "text.autoconfig.skyblocker.option.locations.dwarvenMines.MetalDetectorHelper": "Metal Detector Helper", - "text.autoconfig.skyblocker.option.locations.dwarvenMines.MetalDetectorHelper.@Tooltip": "Helper for the metal detector puzzle in the Mines of Divan in the Crystal Hollows.", + "text.autoconfig.skyblocker.option.locations.dwarvenMines.MetalDetectorHelper.@Tooltip": "Helper for the metal detector puzzle in the Mines of Divan.", "text.autoconfig.skyblocker.option.locations.dwarvenMines.MetalDetectorHelper.startTip": "Stand still in multiple places unit solver has narrowed down locations to one", "text.autoconfig.skyblocker.option.locations.dwarvenMines.MetalDetectorHelper.foundCenter": "Found center of mines now working faster", "text.autoconfig.skyblocker.option.locations.dwarvenMines.MetalDetectorHelper.foundTreasureMessage": "Found treasure", -- cgit From c04bef8c93f15ba162091db40c6062af47d22515 Mon Sep 17 00:00:00 2001 From: olim Date: Wed, 17 Apr 2024 15:04:10 +0100 Subject: add tests --- .../skyblocker/skyblock/dwarven/MetalDetector.java | 12 ++++---- .../skyblock/dwarven/MetalDetectorTest.java | 34 ++++++++++++++++++++++ 2 files changed, 40 insertions(+), 6 deletions(-) create mode 100644 src/test/java/de/hysky/skyblocker/skyblock/dwarven/MetalDetectorTest.java (limited to 'src/main/java/de/hysky') diff --git a/src/main/java/de/hysky/skyblocker/skyblock/dwarven/MetalDetector.java b/src/main/java/de/hysky/skyblocker/skyblock/dwarven/MetalDetector.java index 203e1880..e302b778 100644 --- a/src/main/java/de/hysky/skyblocker/skyblock/dwarven/MetalDetector.java +++ b/src/main/java/de/hysky/skyblocker/skyblock/dwarven/MetalDetector.java @@ -81,14 +81,14 @@ public class MetalDetector { new Vec3i(-37, -21, -22) // -37, -21, -22 )); - private static Vec3i minesCenter = null; + protected static Vec3i minesCenter = null; private static double previousDistance; private static Vec3d previousPlayerPos; - private static boolean newTreasure = true; + protected static boolean newTreasure = true; private static boolean startedLooking = false; - private static List possibleBlocks = new ArrayList<>(); + protected static List possibleBlocks = new ArrayList<>(); public static void init() { ClientReceiveMessageEvents.GAME.register(MetalDetector::getDistanceMessage); @@ -151,7 +151,7 @@ public class MetalDetector { } } - private static void updatePossibleBlocks(Double distance, Vec3d playerPos) { + protected static void updatePossibleBlocks(Double distance, Vec3d playerPos) { if (newTreasure) { possibleBlocks = new ArrayList<>(); newTreasure = false; @@ -164,8 +164,8 @@ public class MetalDetector { } } else { - for (int x = -distance.intValue(); x < distance; x++) { - for (int z = -distance.intValue(); z < distance; z++) { + for (int x = -distance.intValue(); x <= distance; x++) { + for (int z = -distance.intValue(); z <= distance; z++) { Vec3i checkPos =new Vec3i((int)(playerPos.x) + x, (int)playerPos.y, (int)playerPos.z + z); if (Math.abs(playerPos.distanceTo(Vec3d.of(checkPos)) - distance) < 0.25) { possibleBlocks.add(checkPos); diff --git a/src/test/java/de/hysky/skyblocker/skyblock/dwarven/MetalDetectorTest.java b/src/test/java/de/hysky/skyblocker/skyblock/dwarven/MetalDetectorTest.java new file mode 100644 index 00000000..22532f96 --- /dev/null +++ b/src/test/java/de/hysky/skyblocker/skyblock/dwarven/MetalDetectorTest.java @@ -0,0 +1,34 @@ +package de.hysky.skyblocker.skyblock.dwarven; + +import net.minecraft.util.math.Vec3d; +import net.minecraft.util.math.Vec3i; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; + +import java.util.ArrayList; + +public class MetalDetectorTest { + + @Test + void testFindPossibleBlocks() { + //test starting without knowing middle + MetalDetector.updatePossibleBlocks(10.0, new Vec3d(0, 0, 0)); + Assertions.assertEquals(MetalDetector.possibleBlocks.size(), 40); + + MetalDetector.updatePossibleBlocks(11.2, new Vec3d(5, 0, 0)); + Assertions.assertEquals(MetalDetector.possibleBlocks.size(), 2); + + MetalDetector.updatePossibleBlocks(10.0, new Vec3d(10, 0, 10)); + Assertions.assertEquals(MetalDetector.possibleBlocks.get(0), new Vec3i(0, 0, 10)); + + //test while knowing the middle location + MetalDetector.possibleBlocks = new ArrayList<>(); + MetalDetector.newTreasure = true; + MetalDetector.minesCenter = new Vec3i(0, 0, 0); + + MetalDetector.updatePossibleBlocks(24.9, new Vec3d(10, 1, 10)); + Assertions.assertEquals(MetalDetector.possibleBlocks.size(), 1); + Assertions.assertEquals(MetalDetector.possibleBlocks.get(0), new Vec3i(1, -20, 20)); + + } +} -- cgit From a7103075422e9989ac204fa84bd1f92486b72077 Mon Sep 17 00:00:00 2001 From: Aaron <51387595+AzureAaron@users.noreply.github.com> Date: Thu, 18 Apr 2024 02:12:29 -0400 Subject: Refactor Metal Detector --- .../hysky/skyblocker/config/SkyblockerConfig.java | 2 +- .../config/categories/DwarvenMinesCategory.java | 8 +- .../auction/widgets/AuctionTypeWidget.java | 2 +- .../skyblock/auction/widgets/SortWidget.java | 2 +- .../skyblocker/skyblock/dwarven/MetalDetector.java | 144 ++++++++++----------- .../resources/assets/skyblocker/lang/en_us.json | 19 +-- 6 files changed, 85 insertions(+), 92 deletions(-) (limited to 'src/main/java/de/hysky') diff --git a/src/main/java/de/hysky/skyblocker/config/SkyblockerConfig.java b/src/main/java/de/hysky/skyblocker/config/SkyblockerConfig.java index 4a1f7502..f1d6d2bb 100644 --- a/src/main/java/de/hysky/skyblocker/config/SkyblockerConfig.java +++ b/src/main/java/de/hysky/skyblocker/config/SkyblockerConfig.java @@ -950,7 +950,7 @@ public class SkyblockerConfig { public boolean solvePuzzler = true; @SerialEntry - public boolean MetalDetectorHelper = true; + public boolean metalDetectorHelper = true; @SerialEntry public DwarvenHud dwarvenHud = new DwarvenHud(); diff --git a/src/main/java/de/hysky/skyblocker/config/categories/DwarvenMinesCategory.java b/src/main/java/de/hysky/skyblocker/config/categories/DwarvenMinesCategory.java index 67b8632b..43ea8a22 100644 --- a/src/main/java/de/hysky/skyblocker/config/categories/DwarvenMinesCategory.java +++ b/src/main/java/de/hysky/skyblocker/config/categories/DwarvenMinesCategory.java @@ -43,10 +43,10 @@ public class DwarvenMinesCategory { .controller(ConfigUtils::createBooleanController) .build()) .option(Option.createBuilder() - .name(Text.translatable("text.autoconfig.skyblocker.option.locations.dwarvenMines.MetalDetectorHelper")) - .description(OptionDescription.of(Text.translatable("text.autoconfig.skyblocker.option.locations.dwarvenMines.MetalDetectorHelper.@Tooltip"))) .binding(defaults.locations.dwarvenMines.MetalDetectorHelper, - () -> config.locations.dwarvenMines.MetalDetectorHelper, - newValue -> config.locations.dwarvenMines.MetalDetectorHelper = newValue) + .name(Text.translatable("text.autoconfig.skyblocker.option.locations.dwarvenMines.metalDetectorHelper")) + .description(OptionDescription.of(Text.translatable("text.autoconfig.skyblocker.option.locations.dwarvenMines.metalDetectorHelper.@Tooltip"))) .binding(defaults.locations.dwarvenMines.metalDetectorHelper, + () -> config.locations.dwarvenMines.metalDetectorHelper, + newValue -> config.locations.dwarvenMines.metalDetectorHelper = newValue) .controller(ConfigUtils::createBooleanController) .build()) diff --git a/src/main/java/de/hysky/skyblocker/skyblock/auction/widgets/AuctionTypeWidget.java b/src/main/java/de/hysky/skyblocker/skyblock/auction/widgets/AuctionTypeWidget.java index 0caa233a..4334fc58 100644 --- a/src/main/java/de/hysky/skyblocker/skyblock/auction/widgets/AuctionTypeWidget.java +++ b/src/main/java/de/hysky/skyblocker/skyblock/auction/widgets/AuctionTypeWidget.java @@ -17,7 +17,7 @@ public class AuctionTypeWidget extends SliderWidget { super(x, y, 17, 17, Text.literal("Auction Type Widget"), slotClick, Option.ALL); } - public enum Option implements OptionInfo { + public enum Option implements SliderWidget.OptionInfo { ALL("all.png"), BIN("bin.png"), AUC("auctions.png"); diff --git a/src/main/java/de/hysky/skyblocker/skyblock/auction/widgets/SortWidget.java b/src/main/java/de/hysky/skyblocker/skyblock/auction/widgets/SortWidget.java index dab3c6b4..b2450b59 100644 --- a/src/main/java/de/hysky/skyblocker/skyblock/auction/widgets/SortWidget.java +++ b/src/main/java/de/hysky/skyblocker/skyblock/auction/widgets/SortWidget.java @@ -17,7 +17,7 @@ public class SortWidget extends SliderWidget { super(x, y, 36, 9, Text.literal("Sort Widget"), clickSlot, Option.HIGH); } - public enum Option implements OptionInfo { + public enum Option implements SliderWidget.OptionInfo { HIGH("high.png"), LOW("low.png"), SOON("soon.png"), diff --git a/src/main/java/de/hysky/skyblocker/skyblock/dwarven/MetalDetector.java b/src/main/java/de/hysky/skyblocker/skyblock/dwarven/MetalDetector.java index e302b778..84154e12 100644 --- a/src/main/java/de/hysky/skyblocker/skyblock/dwarven/MetalDetector.java +++ b/src/main/java/de/hysky/skyblocker/skyblock/dwarven/MetalDetector.java @@ -11,6 +11,7 @@ import net.minecraft.client.MinecraftClient; import net.minecraft.entity.decoration.ArmorStandEntity; import net.minecraft.text.Text; import net.minecraft.util.Formatting; +import net.minecraft.util.Util; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Box; import net.minecraft.util.math.Vec3d; @@ -21,73 +22,66 @@ import java.util.regex.Matcher; import java.util.regex.Pattern; public class MetalDetector { - private static final MinecraftClient CLIENT = MinecraftClient.getInstance(); - private static final float[] LIGHT_GRAY = { 192 / 255f, 192 / 255f, 192 / 255f }; - private static final Pattern TREASURE_PATTERN = Pattern.compile("(§3§lTREASURE: §b)(\\d+\\.\\d)m"); - private static final Pattern KEEPER_PATTERN = Pattern.compile("Keeper of (\\w+)"); - private static final HashMap keeperOffsets = new HashMap<>() {{ - put("Diamond", new Vec3i(33, 0, 3)); - put("Lapis", new Vec3i(-33, 0, -3)); - put("Emerald", new Vec3i(-3, 0, 33)); - put("Gold", new Vec3i(3, 0, -33)); - }}; - - private static final HashSet knownChestOffsets = new HashSet<>(Arrays.asList( - new Vec3i(-38, -22, 26), // -38, -22, 26 - new Vec3i(38, -22, -26), // 38, -22, -26 - new Vec3i(-40, -22, 18), // -40, -22, 18 - new Vec3i(-41, -20, 22), // -41, -20, 22 - new Vec3i(-5, -21, 16), // -5, -21, 16 - new Vec3i(40, -22, -30), // 40, -22, -30 - new Vec3i(-42, -20, -28), // -42, -20, -28 - new Vec3i(-43, -22, -40), // -43, -22, -40 - new Vec3i(42, -19, -41), // 42, -19, -41 - new Vec3i(43, -21, -16), // 43, -21, -16 - new Vec3i(-1, -22, -20), // -1, -22, -20 - new Vec3i(6, -21, 28), // 6, -21, 28 - new Vec3i(7, -21, 11), // 7, -21, 11 - new Vec3i(7, -21, 22), // 7, -21, 22 - new Vec3i(-12, -21, -44), // -12, -21, -44 - new Vec3i(12, -22, 31), // 12, -22, 31 - new Vec3i(12, -22, -22), // 12, -22, -22 - new Vec3i(12, -21, 7), // 12, -21, 7 - new Vec3i(12, -21, -43), // 12, -21, -43 - new Vec3i(-14, -21, 43), // -14, -21, 43 - new Vec3i(-14, -21, 22), // -14, -21, 22 - new Vec3i(-17, -21, 20), // -17, -21, 20 - new Vec3i(-20, -22, 0), // -20, -22, 0 - new Vec3i(1, -21, 20), // 1, -21, 20 - new Vec3i(19, -22, 29), // 19, -22, 29 - new Vec3i(20, -22, 0), // 20, -22, 0 - new Vec3i(20, -21, -26), // 20, -21, -26 - new Vec3i(-23, -22, 40), // -23, -22, 40 - new Vec3i(22, -21, -14), // 22, -21, -14 - new Vec3i(-24, -22, 12), // -24, -22, 12 - new Vec3i(23, -22, 26), // 23, -22, 26 - new Vec3i(23, -22, -39), // 23, -22, -39 - new Vec3i(24, -22, 27), // 24, -22, 27 - new Vec3i(25, -22, 17), // 25, -22, 17 - new Vec3i(29, -21, -44), // 29, -21, -44 - new Vec3i(-31, -21, -12), // -31, -21, -12 - new Vec3i(-31, -21, -40), // -31, -21, -40 - new Vec3i(30, -21, -25), // 30, -21, -25 - new Vec3i(-32, -21, -40), // -32, -21, -40 - new Vec3i(-36, -20, 42), // -36, -20, 42 - new Vec3i(-37, -21, -14), // -37, -21, -14 - new Vec3i(-37, -21, -22) // -37, -21, -22 - )); + private static final HashMap keeperOffsets = Util.make(new HashMap<>(), map -> { + map.put("Diamond", new Vec3i(33, 0, 3)); + map.put("Lapis", new Vec3i(-33, 0, -3)); + map.put("Emerald", new Vec3i(-3, 0, 33)); + map.put("Gold", new Vec3i(3, 0, -33)); + }); + private static final HashSet knownChestOffsets = Util.make(new HashSet<>(), set -> { + set.add(new Vec3i(-38, -22, 26)); // -38, -22, 26 + set.add(new Vec3i(38, -22, -26)); // 38, -22, -26 + set.add(new Vec3i(-40, -22, 18)); // -40, -22, 18 + set.add(new Vec3i(-41, -20, 22)); // -41, -20, 22 + set.add(new Vec3i(-5, -21, 16)); // -5, -21, 16 + set.add(new Vec3i(40, -22, -30)); // 40, -22, -30 + set.add(new Vec3i(-42, -20, -28)); // -42, -20, -28 + set.add(new Vec3i(-43, -22, -40)); // -43, -22, -40 + set.add(new Vec3i(42, -19, -41)); // 42, -19, -41 + set.add(new Vec3i(43, -21, -16)); // 43, -21, -16 + set.add(new Vec3i(-1, -22, -20)); // -1, -22, -20 + set.add(new Vec3i(6, -21, 28)); // 6, -21, 28 + set.add(new Vec3i(7, -21, 11)); // 7, -21, 11 + set.add(new Vec3i(7, -21, 22)); // 7, -21, 22 + set.add(new Vec3i(-12, -21, -44)); // -12, -21, -44 + set.add(new Vec3i(12, -22, 31)); // 12, -22, 31 + set.add(new Vec3i(12, -22, -22)); // 12, -22, -22 + set.add(new Vec3i(12, -21, 7)); // 12, -21, 7 + set.add(new Vec3i(12, -21, -43)); // 12, -21, -43 + set.add(new Vec3i(-14, -21, 43)); // -14, -21, 43 + set.add(new Vec3i(-14, -21, 22)); // -14, -21, 22 + set.add(new Vec3i(-17, -21, 20)); // -17, -21, 20 + set.add(new Vec3i(-20, -22, 0)); // -20, -22, 0 + set.add(new Vec3i(1, -21, 20)); // 1, -21, 20 + set.add(new Vec3i(19, -22, 29)); // 19, -22, 29 + set.add(new Vec3i(20, -22, 0)); // 20, -22, 0 + set.add(new Vec3i(20, -21, -26)); // 20, -21, -26 + set.add(new Vec3i(-23, -22, 40)); // -23, -22, 40 + set.add(new Vec3i(22, -21, -14)); // 22, -21, -14 + set.add(new Vec3i(-24, -22, 12)); // -24, -22, 12 + set.add(new Vec3i(23, -22, 26)); // 23, -22, 26 + set.add(new Vec3i(23, -22, -39)); // 23, -22, -39 + set.add(new Vec3i(24, -22, 27)); // 24, -22, 27 + set.add(new Vec3i(25, -22, 17)); // 25, -22, 17 + set.add(new Vec3i(29, -21, -44)); // 29, -21, -44 + set.add(new Vec3i(-31, -21, -12)); // -31, -21, -12 + set.add(new Vec3i(-31, -21, -40)); // -31, -21, -40 + set.add(new Vec3i(30, -21, -25)); // 30, -21, -25 + set.add(new Vec3i(-32, -21, -40)); // -32, -21, -40 + set.add(new Vec3i(-36, -20, 42)); // -36, -20, 42 + set.add(new Vec3i(-37, -21, -14)); // -37, -21, -14 + set.add(new Vec3i(-37, -21, -22)); // -37, -21, -22 + }); protected static Vec3i minesCenter = null; private static double previousDistance; private static Vec3d previousPlayerPos; protected static boolean newTreasure = true; - private static boolean startedLooking = false; - protected static List possibleBlocks = new ArrayList<>(); public static void init() { @@ -96,7 +90,7 @@ public class MetalDetector { } private static void getDistanceMessage(Text text, boolean overlay) { - if (!overlay || !SkyblockerConfigManager.get().locations.dwarvenMines.MetalDetectorHelper || !Utils.isInCrystalHollows() || !(Utils.getIslandArea().substring(2).equals("Mines of Divan")) || CLIENT.player == null) { + if (!overlay || !SkyblockerConfigManager.get().locations.dwarvenMines.metalDetectorHelper || !Utils.isInCrystalHollows() || !(Utils.getIslandArea().substring(2).equals("Mines of Divan")) || CLIENT.player == null) { checkChestFound(text); return; } @@ -113,7 +107,7 @@ public class MetalDetector { //send message when starting looking about how to use mod if (!startedLooking) { startedLooking = true; - CLIENT.player.sendMessage(Constants.PREFIX.get().append(Text.translatable("text.autoconfig.skyblocker.option.locations.dwarvenMines.MetalDetectorHelper.startTip")),false); + CLIENT.player.sendMessage(Constants.PREFIX.get().append(Text.translatable("skyblocker.dwarvenMines.metalDetectorHelper.startTip")), false); } //find the center of the mines if possible to speed up search @@ -129,10 +123,9 @@ public class MetalDetector { //if the amount of possible blocks has changed output that to the user if (possibleBlocks.size() != previousPossibleBlockCount) { if (possibleBlocks.size() == 1) { - CLIENT.player.sendMessage(Constants.PREFIX.get().append(Text.translatable("text.autoconfig.skyblocker.option.locations.dwarvenMines.MetalDetectorHelper.foundTreasureMessage").formatted(Formatting.GREEN)),false); - } - else { - CLIENT.player.sendMessage(Constants.PREFIX.get().append(Text.translatable("text.autoconfig.skyblocker.option.locations.dwarvenMines.MetalDetectorHelper.possibleTreasureLocationsMessage").append(Text.of(String.valueOf(possibleBlocks.size())))),false); + CLIENT.player.sendMessage(Constants.PREFIX.get().append(Text.translatable("skyblocker.dwarvenMines.metalDetectorHelper.foundTreasureMessage").formatted(Formatting.GREEN)), false); + } else { + CLIENT.player.sendMessage(Constants.PREFIX.get().append(Text.translatable("skyblocker.dwarvenMines.metalDetectorHelper.possibleTreasureLocationsMessage").append(Text.of(String.valueOf(possibleBlocks.size())))), false); } } @@ -151,22 +144,21 @@ public class MetalDetector { } } - protected static void updatePossibleBlocks(Double distance, Vec3d playerPos) { + protected static void updatePossibleBlocks(double distance, Vec3d playerPos) { if (newTreasure) { possibleBlocks = new ArrayList<>(); newTreasure = false; - if (minesCenter != null) {//if center of the mines is known use the predefined offsets to filter the locations + if (minesCenter != null) { //if center of the mines is known use the predefined offsets to filter the locations for (Vec3i knownOffset : knownChestOffsets) { - Vec3i checkPos = minesCenter.add(knownOffset).add(0,1,0); + Vec3i checkPos = minesCenter.add(knownOffset).add(0, 1, 0); if (Math.abs(playerPos.distanceTo(Vec3d.of(checkPos)) - distance) < 0.25) { possibleBlocks.add(checkPos); } } - } - else { - for (int x = -distance.intValue(); x <= distance; x++) { - for (int z = -distance.intValue(); z <= distance; z++) { - Vec3i checkPos =new Vec3i((int)(playerPos.x) + x, (int)playerPos.y, (int)playerPos.z + z); + } else { + for (int x = (int) -distance; x <= distance; x++) { + for (int z = (int) -distance; z <= distance; z++) { + Vec3i checkPos = new Vec3i((int) playerPos.x + x, (int) playerPos.y, (int) playerPos.z + z); if (Math.abs(playerPos.distanceTo(Vec3d.of(checkPos)) - distance) < 0.25) { possibleBlocks.add(checkPos); } @@ -182,7 +174,7 @@ public class MetalDetector { if (possibleBlocks.isEmpty()) { newTreasure = true; if (CLIENT.player != null) { - CLIENT.player.sendMessage(Constants.PREFIX.get().append(Text.translatable("text.autoconfig.skyblocker.option.locations.dwarvenMines.MetalDetectorHelper.somethingWentWrongMessage").formatted(Formatting.RED)),false); + CLIENT.player.sendMessage(Constants.PREFIX.get().append(Text.translatable("skyblocker.dwarvenMines.metalDetectorHelper.somethingWentWrongMessage").formatted(Formatting.RED)), false); } } } @@ -201,7 +193,7 @@ public class MetalDetector { if (nameMatcher.matches()) { Vec3i offset = keeperOffsets.get(nameMatcher.group(1)); minesCenter = armorStand.getBlockPos().add(offset); - CLIENT.player.sendMessage(Constants.PREFIX.get().append(Text.translatable("text.autoconfig.skyblocker.option.locations.dwarvenMines.MetalDetectorHelper.foundCenter").formatted(Formatting.GREEN)),false); + CLIENT.player.sendMessage(Constants.PREFIX.get().append(Text.translatable("skyblocker.dwarvenMines.metalDetectorHelper.foundCenter").formatted(Formatting.GREEN)), false); return; } } @@ -209,20 +201,20 @@ public class MetalDetector { private static void render(WorldRenderContext context) { //only render enabled and if there is a few location options and in the mines of divan - if (!SkyblockerConfigManager.get().locations.dwarvenMines.MetalDetectorHelper || possibleBlocks.isEmpty() || possibleBlocks.size() > 8 || !(Utils.getIslandArea().substring(2).equals("Mines of Divan"))) { + if (!SkyblockerConfigManager.get().locations.dwarvenMines.metalDetectorHelper || possibleBlocks.isEmpty() || possibleBlocks.size() > 8 || !(Utils.getIslandArea().substring(2).equals("Mines of Divan"))) { return; } //only one location render just that and guiding line to it if (possibleBlocks.size() == 1) { Vec3i block = possibleBlocks.get(0).add(0, -1, 0); //the block you are taken to is one block above the chest - CrystalsWaypoint waypoint = new CrystalsWaypoint(CrystalsWaypoint.Category.MINES_OF_DIVAN, Text.translatable("text.autoconfig.skyblocker.option.locations.dwarvenMines.MetalDetectorHelper.treasure"), new BlockPos(block.getX(), block.getY(), block.getZ())); + CrystalsWaypoint waypoint = new CrystalsWaypoint(CrystalsWaypoint.Category.MINES_OF_DIVAN, Text.translatable("skyblocker.dwarvenMines.metalDetectorHelper.treasure"), new BlockPos(block.getX(), block.getY(), block.getZ())); waypoint.render(context); RenderHelper.renderLineFromCursor(context, Vec3d.ofCenter(block), LIGHT_GRAY, 1f, 5f); return; } for (Vec3i block : possibleBlocks) { - CrystalsWaypoint waypoint = new CrystalsWaypoint(CrystalsWaypoint.Category.MINES_OF_DIVAN, Text.translatable("text.autoconfig.skyblocker.option.locations.dwarvenMines.MetalDetectorHelper.possible"), new BlockPos(block.getX(), block.getY(), block.getZ())); + CrystalsWaypoint waypoint = new CrystalsWaypoint(CrystalsWaypoint.Category.MINES_OF_DIVAN, Text.translatable("skyblocker.dwarvenMines.metalDetectorHelper.possible"), new BlockPos(block.getX(), block.getY(), block.getZ())); waypoint.render(context); } } diff --git a/src/main/resources/assets/skyblocker/lang/en_us.json b/src/main/resources/assets/skyblocker/lang/en_us.json index 5fa39b63..7b42ee39 100644 --- a/src/main/resources/assets/skyblocker/lang/en_us.json +++ b/src/main/resources/assets/skyblocker/lang/en_us.json @@ -341,15 +341,8 @@ "text.autoconfig.skyblocker.option.locations.dwarvenMines.enableDrillFuel": "Enable Drill Fuel", "text.autoconfig.skyblocker.option.locations.dwarvenMines.solveFetchur": "Solve Fetchur", "text.autoconfig.skyblocker.option.locations.dwarvenMines.solvePuzzler": "Solve Puzzler Puzzle", - "text.autoconfig.skyblocker.option.locations.dwarvenMines.MetalDetectorHelper": "Metal Detector Helper", - "text.autoconfig.skyblocker.option.locations.dwarvenMines.MetalDetectorHelper.@Tooltip": "Helper for the metal detector puzzle in the Mines of Divan.", - "text.autoconfig.skyblocker.option.locations.dwarvenMines.MetalDetectorHelper.startTip": "Stand still in multiple places unit solver has narrowed down locations to one", - "text.autoconfig.skyblocker.option.locations.dwarvenMines.MetalDetectorHelper.foundCenter": "Found center of mines now working faster", - "text.autoconfig.skyblocker.option.locations.dwarvenMines.MetalDetectorHelper.foundTreasureMessage": "Found treasure", - "text.autoconfig.skyblocker.option.locations.dwarvenMines.MetalDetectorHelper.possibleTreasureLocationsMessage": "Possible treasure locations: ", - "text.autoconfig.skyblocker.option.locations.dwarvenMines.MetalDetectorHelper.somethingWentWrongMessage": "Something went wrong with the metal detector. Trying again", - "text.autoconfig.skyblocker.option.locations.dwarvenMines.MetalDetectorHelper.treasure": "Treasure", - "text.autoconfig.skyblocker.option.locations.dwarvenMines.MetalDetectorHelper.possible": "Possible", + "text.autoconfig.skyblocker.option.locations.dwarvenMines.metalDetectorHelper": "Metal Detector Helper", + "text.autoconfig.skyblocker.option.locations.dwarvenMines.metalDetectorHelper.@Tooltip": "Helper for the metal detector puzzle in the Mines of Divan.", "text.autoconfig.skyblocker.option.locations.dwarvenMines.dwarvenHud": "Dwarven HUD", "text.autoconfig.skyblocker.option.locations.dwarvenMines.dwarvenHud.enabledCommissions": "Enable Commissions", "text.autoconfig.skyblocker.option.locations.dwarvenMines.dwarvenHud.enabledPowder": "Enable Powder", @@ -524,6 +517,14 @@ "skyblocker.exotic.glitched": "GLITCHED", "skyblocker.exotic.exotic": "EXOTIC", + "skyblocker.dwarvenMines.metalDetectorHelper.startTip": "Stand still in multiple places unit solver has narrowed down locations to one", + "skyblocker.dwarvenMines.metalDetectorHelper.foundCenter": "Found center of mines now working faster", + "skyblocker.dwarvenMines.metalDetectorHelper.foundTreasureMessage": "Found treasure", + "skyblocker.dwarvenMines.metalDetectorHelper.possibleTreasureLocationsMessage": "Possible treasure locations: ", + "skyblocker.dwarvenMines.metalDetectorHelper.somethingWentWrongMessage": "Something went wrong with the metal detector. Trying again", + "skyblocker.dwarvenMines.metalDetectorHelper.treasure": "Treasure", + "skyblocker.dwarvenMines.metalDetectorHelper.possible": "Possible", + "skyblocker.end.hud.zealotsSinceLastEye": "Since last eye: %d", "skyblocker.end.hud.zealotsTotalKills": "Total kills: %d", "skyblocker.end.hud.avgKillsPerEye": "Avg kills per eye: %d", -- cgit From 2cc97dbbd57856ad350fc321a944a7871a2440f2 Mon Sep 17 00:00:00 2001 From: Aaron <51387595+AzureAaron@users.noreply.github.com> Date: Thu, 18 Apr 2024 02:20:48 -0400 Subject: Add CH render check --- src/main/java/de/hysky/skyblocker/skyblock/dwarven/MetalDetector.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/main/java/de/hysky') diff --git a/src/main/java/de/hysky/skyblocker/skyblock/dwarven/MetalDetector.java b/src/main/java/de/hysky/skyblocker/skyblock/dwarven/MetalDetector.java index 84154e12..24756104 100644 --- a/src/main/java/de/hysky/skyblocker/skyblock/dwarven/MetalDetector.java +++ b/src/main/java/de/hysky/skyblocker/skyblock/dwarven/MetalDetector.java @@ -201,7 +201,7 @@ public class MetalDetector { private static void render(WorldRenderContext context) { //only render enabled and if there is a few location options and in the mines of divan - if (!SkyblockerConfigManager.get().locations.dwarvenMines.metalDetectorHelper || possibleBlocks.isEmpty() || possibleBlocks.size() > 8 || !(Utils.getIslandArea().substring(2).equals("Mines of Divan"))) { + if (!SkyblockerConfigManager.get().locations.dwarvenMines.metalDetectorHelper || !Utils.isInCrystalHollows() || possibleBlocks.isEmpty() || possibleBlocks.size() > 8 || !(Utils.getIslandArea().substring(2).equals("Mines of Divan"))) { return; } //only one location render just that and guiding line to it -- cgit From b95f348c9288185118f4858e9cf40d731d26d274 Mon Sep 17 00:00:00 2001 From: olim Date: Thu, 18 Apr 2024 17:56:10 +0100 Subject: add changes and comment code --- .../skyblocker/skyblock/dwarven/MetalDetector.java | 33 ++++++++++++++++++++-- 1 file changed, 30 insertions(+), 3 deletions(-) (limited to 'src/main/java/de/hysky') diff --git a/src/main/java/de/hysky/skyblocker/skyblock/dwarven/MetalDetector.java b/src/main/java/de/hysky/skyblocker/skyblock/dwarven/MetalDetector.java index 24756104..9a1ad53d 100644 --- a/src/main/java/de/hysky/skyblocker/skyblock/dwarven/MetalDetector.java +++ b/src/main/java/de/hysky/skyblocker/skyblock/dwarven/MetalDetector.java @@ -17,14 +17,16 @@ import net.minecraft.util.math.Box; import net.minecraft.util.math.Vec3d; import net.minecraft.util.math.Vec3i; +import java.awt.*; import java.util.*; +import java.util.List; import java.util.regex.Matcher; import java.util.regex.Pattern; public class MetalDetector { private static final MinecraftClient CLIENT = MinecraftClient.getInstance(); private static final float[] LIGHT_GRAY = { 192 / 255f, 192 / 255f, 192 / 255f }; - private static final Pattern TREASURE_PATTERN = Pattern.compile("(§3§lTREASURE: §b)(\\d+\\.\\d)m"); + private static final Pattern TREASURE_PATTERN = Pattern.compile("(§3§lTREASURE: §b)(\\d+\\.?\\d?)m"); private static final Pattern KEEPER_PATTERN = Pattern.compile("Keeper of (\\w+)"); private static final HashMap keeperOffsets = Util.make(new HashMap<>(), map -> { map.put("Diamond", new Vec3i(33, 0, 3)); @@ -89,6 +91,12 @@ public class MetalDetector { WorldRenderEvents.AFTER_TRANSLUCENT.register(MetalDetector::render); } + /** + * process + * when a message with the distance to the treasure is sent to the player and then update the helper and workout possible locations using that message + * @param text message sent + * @param overlay if its to the overlay + */ private static void getDistanceMessage(Text text, boolean overlay) { if (!overlay || !SkyblockerConfigManager.get().locations.dwarvenMines.metalDetectorHelper || !Utils.isInCrystalHollows() || !(Utils.getIslandArea().substring(2).equals("Mines of Divan")) || CLIENT.player == null) { checkChestFound(text); @@ -134,6 +142,10 @@ public class MetalDetector { previousPlayerPos = playerPos; } + /** + * reset when if message is sent saying the player found the treasure + * @param text message sent to player + */ private static void checkChestFound(Text text) { if (!Utils.isInCrystalHollows() || !(Utils.getIslandArea().substring(2).equals("Mines of Divan")) || CLIENT.player == null) { return; @@ -144,6 +156,12 @@ public class MetalDetector { } } + /** + * using the distance the treasure is from the player work out blocks that are that far away and narrows down possible locations until there is one left + * @param distance how far the treasure is from the player + * @param playerPos where the player is + */ + protected static void updatePossibleBlocks(double distance, Vec3d playerPos) { if (newTreasure) { possibleBlocks = new ArrayList<>(); @@ -179,6 +197,10 @@ public class MetalDetector { } } + /** + * uses the labels for the keepers names to find the central point of the mines of divan so the known offsets can be used + */ + private static void findCenterOfMines() { if (CLIENT.player == null || CLIENT.world == null) { return; @@ -199,6 +221,11 @@ public class MetalDetector { } } + /** + * renders waypoints for the location of treasure / possible treasure + * @param context world render context + */ + private static void render(WorldRenderContext context) { //only render enabled and if there is a few location options and in the mines of divan if (!SkyblockerConfigManager.get().locations.dwarvenMines.metalDetectorHelper || !Utils.isInCrystalHollows() || possibleBlocks.isEmpty() || possibleBlocks.size() > 8 || !(Utils.getIslandArea().substring(2).equals("Mines of Divan"))) { @@ -207,14 +234,14 @@ public class MetalDetector { //only one location render just that and guiding line to it if (possibleBlocks.size() == 1) { Vec3i block = possibleBlocks.get(0).add(0, -1, 0); //the block you are taken to is one block above the chest - CrystalsWaypoint waypoint = new CrystalsWaypoint(CrystalsWaypoint.Category.MINES_OF_DIVAN, Text.translatable("skyblocker.dwarvenMines.metalDetectorHelper.treasure"), new BlockPos(block.getX(), block.getY(), block.getZ())); + CrystalsWaypoint waypoint = new CrystalsWaypoint(CrystalsWaypoint.Category.CORLEONE, Text.translatable("skyblocker.dwarvenMines.metalDetectorHelper.treasure"), new BlockPos(block.getX(), block.getY(), block.getZ())); waypoint.render(context); RenderHelper.renderLineFromCursor(context, Vec3d.ofCenter(block), LIGHT_GRAY, 1f, 5f); return; } for (Vec3i block : possibleBlocks) { - CrystalsWaypoint waypoint = new CrystalsWaypoint(CrystalsWaypoint.Category.MINES_OF_DIVAN, Text.translatable("skyblocker.dwarvenMines.metalDetectorHelper.possible"), new BlockPos(block.getX(), block.getY(), block.getZ())); + CrystalsWaypoint waypoint = new CrystalsWaypoint(CrystalsWaypoint.Category.CORLEONE, Text.translatable("skyblocker.dwarvenMines.metalDetectorHelper.possible"), new BlockPos(block.getX(), block.getY(), block.getZ())); waypoint.render(context); } } -- cgit From 8178c283fd884515afdab10e42eafc46f819dcd4 Mon Sep 17 00:00:00 2001 From: Kevinthegreat <92656833+kevinthegreat1@users.noreply.github.com> Date: Thu, 18 Apr 2024 19:21:23 -0400 Subject: Refactor MetalDetector --- .../skyblocker/skyblock/dwarven/MetalDetector.java | 33 +++++++++++----------- .../resources/assets/skyblocker/lang/en_us.json | 4 +-- .../skyblock/dwarven/MetalDetectorTest.java | 2 -- 3 files changed, 19 insertions(+), 20 deletions(-) (limited to 'src/main/java/de/hysky') diff --git a/src/main/java/de/hysky/skyblocker/skyblock/dwarven/MetalDetector.java b/src/main/java/de/hysky/skyblocker/skyblock/dwarven/MetalDetector.java index 9a1ad53d..31dced3b 100644 --- a/src/main/java/de/hysky/skyblocker/skyblock/dwarven/MetalDetector.java +++ b/src/main/java/de/hysky/skyblocker/skyblock/dwarven/MetalDetector.java @@ -17,8 +17,9 @@ import net.minecraft.util.math.Box; import net.minecraft.util.math.Vec3d; import net.minecraft.util.math.Vec3i; -import java.awt.*; -import java.util.*; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.HashSet; import java.util.List; import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -92,10 +93,10 @@ public class MetalDetector { } /** - * process - * when a message with the distance to the treasure is sent to the player and then update the helper and workout possible locations using that message - * @param text message sent - * @param overlay if its to the overlay + * Processes the message with the distance to the treasure, updates the helper, and works out possible locations using that message. + * + * @param text the message sent to the player + * @param overlay if the message is an overlay message */ private static void getDistanceMessage(Text text, boolean overlay) { if (!overlay || !SkyblockerConfigManager.get().locations.dwarvenMines.metalDetectorHelper || !Utils.isInCrystalHollows() || !(Utils.getIslandArea().substring(2).equals("Mines of Divan")) || CLIENT.player == null) { @@ -143,8 +144,9 @@ public class MetalDetector { } /** - * reset when if message is sent saying the player found the treasure - * @param text message sent to player + * Processes the found treasure message and resets the helper + * + * @param text the message sent to the player */ private static void checkChestFound(Text text) { if (!Utils.isInCrystalHollows() || !(Utils.getIslandArea().substring(2).equals("Mines of Divan")) || CLIENT.player == null) { @@ -157,11 +159,12 @@ public class MetalDetector { } /** - * using the distance the treasure is from the player work out blocks that are that far away and narrows down possible locations until there is one left - * @param distance how far the treasure is from the player - * @param playerPos where the player is + * Works out the possible locations the treasure could be using the distance the treasure is from the player and + * narrows down possible locations until there is one left. + * + * @param distance the distance the treasure is from the player squared + * @param playerPos the position of the player */ - protected static void updatePossibleBlocks(double distance, Vec3d playerPos) { if (newTreasure) { possibleBlocks = new ArrayList<>(); @@ -198,9 +201,8 @@ public class MetalDetector { } /** - * uses the labels for the keepers names to find the central point of the mines of divan so the known offsets can be used + * Uses the labels for the keepers names to find the central point of the mines of divan so the known offsets can be used. */ - private static void findCenterOfMines() { if (CLIENT.player == null || CLIENT.world == null) { return; @@ -222,10 +224,9 @@ public class MetalDetector { } /** - * renders waypoints for the location of treasure / possible treasure + * Renders waypoints for the location of treasure or possible treasure. * @param context world render context */ - private static void render(WorldRenderContext context) { //only render enabled and if there is a few location options and in the mines of divan if (!SkyblockerConfigManager.get().locations.dwarvenMines.metalDetectorHelper || !Utils.isInCrystalHollows() || possibleBlocks.isEmpty() || possibleBlocks.size() > 8 || !(Utils.getIslandArea().substring(2).equals("Mines of Divan"))) { diff --git a/src/main/resources/assets/skyblocker/lang/en_us.json b/src/main/resources/assets/skyblocker/lang/en_us.json index 7b42ee39..42f0f505 100644 --- a/src/main/resources/assets/skyblocker/lang/en_us.json +++ b/src/main/resources/assets/skyblocker/lang/en_us.json @@ -517,8 +517,8 @@ "skyblocker.exotic.glitched": "GLITCHED", "skyblocker.exotic.exotic": "EXOTIC", - "skyblocker.dwarvenMines.metalDetectorHelper.startTip": "Stand still in multiple places unit solver has narrowed down locations to one", - "skyblocker.dwarvenMines.metalDetectorHelper.foundCenter": "Found center of mines now working faster", + "skyblocker.dwarvenMines.metalDetectorHelper.startTip": "Stand still in multiple places until the solver has narrowed down possible locations to one", + "skyblocker.dwarvenMines.metalDetectorHelper.foundCenter": "Found the center of mines, now working faster", "skyblocker.dwarvenMines.metalDetectorHelper.foundTreasureMessage": "Found treasure", "skyblocker.dwarvenMines.metalDetectorHelper.possibleTreasureLocationsMessage": "Possible treasure locations: ", "skyblocker.dwarvenMines.metalDetectorHelper.somethingWentWrongMessage": "Something went wrong with the metal detector. Trying again", diff --git a/src/test/java/de/hysky/skyblocker/skyblock/dwarven/MetalDetectorTest.java b/src/test/java/de/hysky/skyblocker/skyblock/dwarven/MetalDetectorTest.java index 22532f96..2566c88a 100644 --- a/src/test/java/de/hysky/skyblocker/skyblock/dwarven/MetalDetectorTest.java +++ b/src/test/java/de/hysky/skyblocker/skyblock/dwarven/MetalDetectorTest.java @@ -8,7 +8,6 @@ import org.junit.jupiter.api.Test; import java.util.ArrayList; public class MetalDetectorTest { - @Test void testFindPossibleBlocks() { //test starting without knowing middle @@ -29,6 +28,5 @@ public class MetalDetectorTest { MetalDetector.updatePossibleBlocks(24.9, new Vec3d(10, 1, 10)); Assertions.assertEquals(MetalDetector.possibleBlocks.size(), 1); Assertions.assertEquals(MetalDetector.possibleBlocks.get(0), new Vec3i(1, -20, 20)); - } } -- cgit