From f26c7b84a9e2d72d4ba3e7b03283697bfe610ea8 Mon Sep 17 00:00:00 2001 From: DeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com> Date: Thu, 19 Aug 2021 16:07:46 +0200 Subject: finalize --- .../miscfeatures/CrystalMetalDetectorSolver.java | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CrystalMetalDetectorSolver.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CrystalMetalDetectorSolver.java index 22d8e59c..24496593 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CrystalMetalDetectorSolver.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CrystalMetalDetectorSolver.java @@ -37,7 +37,6 @@ public class CrystalMetalDetectorSolver { if (inRange(calculatedDist, dist) && treasureAllowed(pos) && !possibleBlocks.contains(pos) && mc.theWorld.getBlockState(above).getBlock().getRegistryName().equals("minecraft:air")) { possibleBlocks.add(pos); - System.out.println(calculatedDist); } xOffset++; } @@ -52,7 +51,6 @@ public class CrystalMetalDetectorSolver { if (inRange(calculatedDist, dist) && treasureAllowed(pos) && !possibleBlocks.contains(pos) && mc.theWorld.getBlockState(above).getBlock().getRegistryName().equals("minecraft:air")) { possibleBlocks.add(pos); - System.out.println(calculatedDist); } xOffset++; } @@ -63,10 +61,18 @@ public class CrystalMetalDetectorSolver { locations.add(mc.thePlayer.getPosition()); List temp = new ArrayList<>(); for (BlockPos pos : possibleBlocks) { - if (inRange(calculateDistance(new Vec3(pos).addVector(0, 1d, 0), new Vec3(mc.thePlayer.posX, mc.thePlayer.posY, mc.thePlayer.posZ)), dist)) { + if (round(calculateDistance(new Vec3(pos).addVector(0, 1d, 0), new Vec3(mc.thePlayer.posX, mc.thePlayer.posY, mc.thePlayer.posZ)), 1) + == dist) { temp.add(pos); } } + if(temp.size() == 0) { + for (BlockPos pos : possibleBlocks) { + if (inRange(calculateDistance(new Vec3(pos).addVector(0, 1d, 0), new Vec3(mc.thePlayer.posX, mc.thePlayer.posY, mc.thePlayer.posZ)), dist)) { + temp.add(pos); + } + } + } possibleBlocks = temp; sendMessage(); } @@ -125,6 +131,6 @@ public class CrystalMetalDetectorSolver { } private static boolean inRange(float number, float dist) { - return dist + 0.1D >= number && dist - 0.1D <= number; + return dist + 0.15D >= number && dist - 0.15D <= number; } } -- cgit