From a45480d1459375179cdf4a8477929a79208bf417 Mon Sep 17 00:00:00 2001 From: mcmonkey4eva Date: Sat, 22 Nov 2014 20:37:28 -0800 Subject: [PATCH] fix dLocation.find.blocks.within wooops --- .../net/aufdemrand/denizen/objects/dLocation.java | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/main/java/net/aufdemrand/denizen/objects/dLocation.java b/src/main/java/net/aufdemrand/denizen/objects/dLocation.java index 178206eb9a..91cd016f1e 100644 --- a/src/main/java/net/aufdemrand/denizen/objects/dLocation.java +++ b/src/main/java/net/aufdemrand/denizen/objects/dLocation.java @@ -726,14 +726,13 @@ else if (yaw < 315) Location loc = getBlock().getLocation().add(0.5f, 0.5f, 0.5f); fullloop: - for (double x = -(radius); x <= radius; x++) - for (double y = -(radius); y <= radius; y++) + for (double x = -(radius); x <= radius; x++) { + for (double y = -(radius); y <= radius; y++) { for (double z = -(radius); z <= radius; z++) { index++; if (index > max) break fullloop; - if (index > max) - if (Utilities.checkLocation(loc, getBlock().getLocation().add(x, y, z), radius)) + if (Utilities.checkLocation(loc, getBlock().getLocation().add(x, y, z), radius)) { if (!materials.isEmpty()) { for (dMaterial material : materials) { if (material.hasData() && material.getData() != 0) { @@ -744,8 +743,13 @@ else if (yaw < 315) } else if (material.getMaterial() == getBlock().getLocation().add(x, y, z).getBlock().getType()) found.add(new dLocation(getBlock().getLocation().add(x + 0.5, y, z + 0.5))); } - } else found.add(new dLocation(getBlock().getLocation().add(x + 0.5, y, z + 0.5))); + } else { + found.add(new dLocation(getBlock().getLocation().add(x + 0.5, y, z + 0.5))); + } + } } + } + } Collections.sort(found, new Comparator() { @Override