Added a thickness parameter to //hollow.

This commit is contained in:
TomyLobo
2011-12-19 11:58:38 +01:00
parent 936aff06b2
commit 633f6643a5
2 changed files with 23 additions and 4 deletions

View File

@ -2731,7 +2731,7 @@ public class EditSession {
* @return number of blocks affected
* @throws MaxChangedBlocksException
*/
public int hollowOutRegion(Region region) throws MaxChangedBlocksException {
public int hollowOutRegion(Region region, int thickness) throws MaxChangedBlocksException {
int affected = 0;
Set<BlockVector> outside = new HashSet<BlockVector>();
@ -2769,6 +2769,23 @@ public class EditSession {
BaseBlock air = new BaseBlock(BlockID.AIR);
for (int i = 1; i < thickness; ++i) {
final Set<BlockVector> newOutside = new HashSet<BlockVector>(outside);
outer: for (BlockVector position : region) {
for (Vector recurseDirection: recurseDirections) {
BlockVector neighbor = position.add(recurseDirection).toBlockVector();
if (outside.contains(neighbor)) {
newOutside.add(position);
continue outer;
}
}
}
outside = newOutside;
}
outer: for (BlockVector position : region) {
for (Vector recurseDirection: recurseDirections) {
BlockVector neighbor = position.add(recurseDirection).toBlockVector();