Skip to content

Commit

Permalink
Better spheres
Browse files Browse the repository at this point in the history
perfect sphericalism
  • Loading branch information
mcmonkey4eva committed Sep 25, 2014
1 parent c1f0e53 commit 60a6db4
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/main/java/net/aufdemrand/denizen/objects/dLocation.java
Expand Up @@ -700,11 +700,12 @@ else if (yaw < 315)

// dB.log(materials + " " + radius + " ");
attribute.fulfill(2);
Location loc = getBlock().getLocation().add(0.5f, 0.5f, 0.5f);

for (double x = -(radius); x <= radius; x++)
for (double y = -(radius); y <= radius; y++)
for (double z = -(radius); z <= radius; z++)
if (Utilities.checkLocation(this, 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) {
Expand Down Expand Up @@ -746,11 +747,12 @@ else if (attribute.startsWith("surface_blocks")
if (materials == null) return Element.NULL.getAttribute(attribute.fulfill(2));

attribute.fulfill(2);
Location loc = getBlock().getLocation().add(0.5f, 0.5f, 0.5f);

for (double x = -(radius); x <= radius; x++)
for (double y = -(radius); y <= radius; y++)
for (double z = -(radius); z <= radius; z++) {
if (Utilities.checkLocation(this, getBlock().getLocation().add(x, y, z), radius)) {
if (Utilities.checkLocation(loc, getBlock().getLocation().add(x, y, z), radius)) {
Location l = getBlock().getLocation().clone().add(x,y,z);
if (!materials.isEmpty()) {
for (dMaterial material : materials) {
Expand Down Expand Up @@ -823,7 +825,7 @@ else if (attribute.startsWith("npcs")
double radius = aH.matchesDouble(attribute.getContext(2)) ? attribute.getDoubleContext(2) : 10;
attribute.fulfill(2);
for (dNPC npc : DenizenAPI.getSpawnedNPCs())
if (Utilities.checkLocation(this, npc.getLocation(), radius))
if (Utilities.checkLocation(this.getBlock().getLocation(), npc.getLocation(), radius))
found.add(npc);

Collections.sort(found, new Comparator<dNPC>() {
Expand Down

0 comments on commit 60a6db4

Please sign in to comment.