Skip to content

Commit

Permalink
Update ForEachCommand.java
Browse files Browse the repository at this point in the history
  • Loading branch information
aufdemrand committed May 17, 2013
1 parent 5a51c86 commit b19cfd7
Showing 1 changed file with 2 additions and 11 deletions.
Expand Up @@ -74,17 +74,13 @@ public void execute(ScriptEntry scriptEntry) throws CommandExecutionException {
dLocation loc_2 = (dLocation) scriptEntry.getObject("loc_2");
Script script = (Script) scriptEntry.getObject("script");

Boolean stop = (Boolean) scriptEntry.getObject("stop");

// Report to dB
dB.report(getName(),
aH.debugObj("Type", type.toString())
+ (type == Type.LOCATION ? loc_1.debug() + loc_2.debug() : "")
+ script.debug());

if (type == Type.LOCATION) {

dB.echoDebug("Type Location...");

int x_inc = -1;
int y_inc = -1;
Expand All @@ -94,21 +90,16 @@ public void execute(ScriptEntry scriptEntry) throws CommandExecutionException {
if (loc_1.getBlockY() <= loc_2.getBlockY()) y_inc = 1;
if (loc_1.getBlockZ() <= loc_2.getBlockZ()) z_inc = 1;

dB.echoDebug("incs = " + x_inc + " " + y_inc + " " + z_inc);

int x_amt = Math.abs(loc_1.getBlockX() - loc_2.getBlockX());
int y_amt = Math.abs(loc_1.getBlockY() - loc_2.getBlockY());
int z_amt = Math.abs(loc_1.getBlockZ() - loc_2.getBlockZ());

dB.echoDebug("amts = " + x_amt + " " + y_amt + " " + z_amt);

for (int x = 0; x != x_amt + 1; x = x + x_inc) {
for (int y = 0; y != y_amt + 1; y = y + y_inc) {
for (int z = 0; z != z_amt + 1; z = z + z_inc) {
dLocation loc = new dLocation(loc_1.add((double) x, (double) y, (double) z));

dB.echoDebug("x,y,z = " + x + " " + y + " " + z);

dLocation loc = new dLocation(loc_1.add((double) x, (double) y, (double) z));
dB.echoDebug("location: " + loc.dScriptArgValue());

Map<String, String> context = new HashMap<String, String>();
context.put("location", loc.dScriptArgValue());
Expand Down

0 comments on commit b19cfd7

Please sign in to comment.