diff options
author | DeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com> | 2021-08-20 20:43:23 +0200 |
---|---|---|
committer | DeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com> | 2021-08-20 20:43:23 +0200 |
commit | 9ae27a4748cce4713d7cdd3ac56776387be04b52 (patch) | |
tree | 57ffcb3b1c1ab019cad81d16a89ec75a7e1ac843 /src | |
parent | 8c6d02fc0f14b84fa69bfbe697ba00a53fbc19a3 (diff) | |
download | NotEnoughUpdates-9ae27a4748cce4713d7cdd3ac56776387be04b52.tar.gz NotEnoughUpdates-9ae27a4748cce4713d7cdd3ac56776387be04b52.tar.bz2 NotEnoughUpdates-9ae27a4748cce4713d7cdd3ac56776387be04b52.zip |
bug sqaushing
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/io/github/moulberry/notenoughupdates/NEUManager.java | 10 | ||||
-rw-r--r-- | src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CrystalMetalDetectorSolver.java | 24 |
2 files changed, 10 insertions, 24 deletions
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NEUManager.java b/src/main/java/io/github/moulberry/notenoughupdates/NEUManager.java index 2975115c..80fc0667 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/NEUManager.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/NEUManager.java @@ -799,11 +799,11 @@ public class NEUManager { } public void showRecipe(JsonObject item) { - if (item.has("recipe") && Minecraft.getMinecraft().thePlayer.openContainer instanceof ContainerChest) { - ContainerChest container = (ContainerChest) Minecraft.getMinecraft().thePlayer.openContainer; - if (container.getLowerChestInventory().getDisplayName().getUnformattedText().equals("Craft Item")) { - CraftingOverlay.updateItem(item); - } + ContainerChest container = null; + if(Minecraft.getMinecraft().thePlayer.openContainer instanceof ContainerChest) + container = (ContainerChest) Minecraft.getMinecraft().thePlayer.openContainer; + if (item.has("recipe") && container != null && container.getLowerChestInventory().getDisplayName().getUnformattedText().equals("Craft Item")) { + CraftingOverlay.updateItem(item); } else if(item.has("useneucraft") && item.get("useneucraft").getAsBoolean()) { displayGuiItemRecipe(item.get("internalname").getAsString(), ""); } else if(item.has("clickcommand")) { 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 c6ad2ef1..357d8326 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CrystalMetalDetectorSolver.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CrystalMetalDetectorSolver.java @@ -34,9 +34,8 @@ public class CrystalMetalDetectorSolver { y, Math.floor(mc.thePlayer.posZ) + zOffset); BlockPos above = new BlockPos(Math.floor(mc.thePlayer.posX) + xOffset, y + 1, Math.floor(mc.thePlayer.posZ) + zOffset); - xOffset++; - calculatedDist = getPlayerPos().distanceTo(new Vec3(pos).addVector(0D,1D,0D)); - if (inRange(calculatedDist, dist) && treasureAllowed(pos) && !possibleBlocks.contains(pos) && + calculatedDist = getPlayerPos().distanceTo(new Vec3(pos).addVector(0D, 1D, 0D)); + if (round(calculatedDist, 1) == dist && treasureAllowed(pos) && !possibleBlocks.contains(pos) && mc.theWorld.getBlockState(above).getBlock().getRegistryName().equals("minecraft:air")) { possibleBlocks.add(pos); } @@ -49,8 +48,8 @@ public class CrystalMetalDetectorSolver { y, Math.floor(mc.thePlayer.posZ) + zOffset); BlockPos above = new BlockPos(Math.floor(mc.thePlayer.posX) - xOffset, y + 1, Math.floor(mc.thePlayer.posZ) + zOffset); - calculatedDist = getPlayerPos().distanceTo(new Vec3(pos).addVector(0D,1D,0D)); - if (inRange(calculatedDist, dist) && treasureAllowed(pos) && !possibleBlocks.contains(pos) && + calculatedDist = getPlayerPos().distanceTo(new Vec3(pos).addVector(0D, 1D, 0D)); + if (round(calculatedDist, 1) == dist && treasureAllowed(pos) && !possibleBlocks.contains(pos) && mc.theWorld.getBlockState(above).getBlock().getRegistryName().equals("minecraft:air")) { possibleBlocks.add(pos); } @@ -63,18 +62,10 @@ public class CrystalMetalDetectorSolver { locations.add(mc.thePlayer.getPosition()); List<BlockPos> temp = new ArrayList<>(); for (BlockPos pos : possibleBlocks) { - if (round(getPlayerPos().distanceTo(new Vec3(pos).addVector(0D,1D,0D)), 1) - == dist) { + if (round(getPlayerPos().distanceTo(new Vec3(pos).addVector(0D, 1D, 0D)), 1) == dist) { temp.add(pos); } } - if (temp.size() == 0) { - for (BlockPos pos : possibleBlocks) { - if (inRange(getPlayerPos().distanceTo(new Vec3(pos).addVector(0D,1D,0D)), dist)) { - temp.add(pos); - } - } - } possibleBlocks = temp; sendMessage(); } @@ -128,11 +119,6 @@ public class CrystalMetalDetectorSolver { } } - - private static boolean inRange(double number, double dist) { - return dist + 0.1D >= number && dist - 0.1D <= number; - } - private static Vec3 getPlayerPos() { return new Vec3(mc.thePlayer.posX, mc.thePlayer.posY + (mc.thePlayer.getEyeHeight() - mc.thePlayer.getDefaultEyeHeight()), mc.thePlayer.posZ); } |