Skip to content

Commit

Permalink
Add <l@location.facing_blocks[<#>]>
Browse files Browse the repository at this point in the history
  • Loading branch information
Morphan1 committed Jan 18, 2016
1 parent ed1a63d commit b2e54da
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/main/java/net/aufdemrand/denizen/objects/dLocation.java
Expand Up @@ -744,6 +744,26 @@ else if (type == Material.TRAP_DOOR
}
}

// <--[tag]
// @attribute <l@location.facing_blocks[<#>}>
// @returns dList(dLocation)
// @description
// Finds all blocks in the direction this location is facing,
// optionally with a custom range. (Default is 100)
// -->
if (attribute.startsWith("facing_blocks")) {
int range = attribute.getIntContext(1);
if (range < 1) {
range = 100;
}
dList list = new dList();
BlockIterator iterator = new BlockIterator(this, 0, range);
while (iterator.hasNext()) {
list.add(new dLocation(iterator.next().getLocation()).identify());
}
return list.getAttribute(attribute.fulfill(1));
}

// <--[tag]
// @attribute <l@location.line_of_sight[<location>]>
// @returns Element(Boolean)
Expand Down

0 comments on commit b2e54da

Please sign in to comment.