This commit is contained in:
Jesse Boyd 2017-04-20 16:11:33 +10:00
parent 92fef6f5da
commit 86a6a95f63
No known key found for this signature in database
GPG Key ID: 59F1DE6293AF6E1F

View File

@ -1471,63 +1471,63 @@ public class EditSession extends AbstractWorld implements HasFaweQueue, Lighting
return this.changes = visitor.getAffected(); return this.changes = visitor.getAffected();
} }
public int fillDirection(final Vector origin, PlayerDirection direction, final Pattern pattern, final double radius, final int depth, final boolean recursive) throws MaxChangedBlocksException { // public int fillDirection(final Vector origin, PlayerDirection direction, final Pattern pattern, final double radius, final int depth, final boolean recursive) throws MaxChangedBlocksException {
checkNotNull(origin); // checkNotNull(origin);
checkNotNull(pattern); // checkNotNull(pattern);
checkArgument(radius >= 0, "radius >= 0"); // checkArgument(radius >= 0, "radius >= 0");
checkArgument(depth >= 1, "depth >= 1"); // checkArgument(depth >= 1, "depth >= 1");
//
Vector dirVec = direction.vector(); // Vector dirVec = direction.vector();
BlockVector min = origin.toBlockVector(); // BlockVector min = origin.toBlockVector();
BlockVector max = origin.toBlockVector(); // BlockVector max = origin.toBlockVector();
//
CuboidRegion cuboid = new CuboidRegion(new Vector(), new Vector()); // CuboidRegion cuboid = new CuboidRegion(new Vector(), new Vector());
switch (direction) { // switch (direction) {
case NORTH: // case NORTH:
break; // break;
case NORTH_EAST: // case NORTH_EAST:
break; // break;
case EAST: // case EAST:
break; // break;
case SOUTH_EAST: // case SOUTH_EAST:
break; // break;
case SOUTH: // case SOUTH:
break; // break;
case SOUTH_WEST: // case SOUTH_WEST:
break; // break;
case WEST: // case WEST:
break; // break;
case NORTH_WEST: // case NORTH_WEST:
break; // break;
case UP: // case UP:
break; // break;
case DOWN: // case DOWN:
break; // break;
} // }
//
//
//
final MaskIntersection mask = new MaskIntersection(new RegionMask(new EllipsoidRegion(null, origin, new Vector(radius, radius, radius))), new BoundedHeightMask(Math.max( // final MaskIntersection mask = new MaskIntersection(new RegionMask(new EllipsoidRegion(null, origin, new Vector(radius, radius, radius))), new BoundedHeightMask(Math.max(
(origin.getBlockY() - depth) + 1, 0), Math.min(EditSession.this.getMaximumPoint().getBlockY(), origin.getBlockY())), Masks.negate(new ExistingBlockMask(EditSession.this))); // (origin.getBlockY() - depth) + 1, 0), Math.min(EditSession.this.getMaximumPoint().getBlockY(), origin.getBlockY())), Masks.negate(new ExistingBlockMask(EditSession.this)));
//
// Want to replace blocks // // Want to replace blocks
final BlockReplace replace = new BlockReplace(EditSession.this, pattern); // final BlockReplace replace = new BlockReplace(EditSession.this, pattern);
//
// Pick how we're going to visit blocks // // Pick how we're going to visit blocks
RecursiveVisitor visitor; // RecursiveVisitor visitor;
if (recursive) { // if (recursive) {
visitor = new RecursiveVisitor(mask, replace, (int) (radius * 2 + 1), this); // visitor = new RecursiveVisitor(mask, replace, (int) (radius * 2 + 1), this);
} else { // } else {
visitor = new DownwardVisitor(mask, replace, origin.getBlockY(), (int) (radius * 2 + 1), this); // visitor = new DownwardVisitor(mask, replace, origin.getBlockY(), (int) (radius * 2 + 1), this);
} // }
//
// Start at the origin // // Start at the origin
visitor.visit(origin); // visitor.visit(origin);
//
// Execute // // Execute
Operations.completeBlindly(visitor); // Operations.completeBlindly(visitor);
return this.changes = visitor.getAffected(); // return this.changes = visitor.getAffected();
} // }
/** /**
* Remove a cuboid above the given position with a given apothem and a given height. * Remove a cuboid above the given position with a given apothem and a given height.
@ -2141,7 +2141,7 @@ public class EditSession extends AbstractWorld implements HasFaweQueue, Lighting
} }
Operations.completeBlindly(visitor); Operations.completeBlindly(visitor);
return visitor.getAffected(); return getBlockChangeCount();
} }
/** /**