use of com.sk89q.worldedit.function.mask.SolidBlockMask in project FastAsyncWorldEdit by IntellectualSites.
the class BrushTool method trace.
private Vector3 trace(EditSession editSession, Player player, int range, boolean useLastBlock) {
Mask mask = traceMask == null ? new SolidBlockMask(editSession) : traceMask;
new MaskTraverser(mask).reset(editSession);
MaskedTargetBlock tb = new MaskedTargetBlock(mask, player, range, 0.2);
return tb.getMaskedTargetBlock(useLastBlock);
}
use of com.sk89q.worldedit.function.mask.SolidBlockMask in project FastAsyncWorldEdit by IntellectualSites.
the class LayerBrush method build.
@Override
public void build(EditSession editSession, BlockVector3 position, Pattern ignore, double size) throws MaxChangedBlocksException {
final AdjacentAnyMask adjacent = new AdjacentAnyMask(new BlockMask(editSession).add(BlockTypes.AIR, BlockTypes.CAVE_AIR, BlockTypes.VOID_AIR), editSession.getMinY(), editSession.getMaxY());
final SolidBlockMask solid = new SolidBlockMask(editSession);
final RadiusMask radius = new RadiusMask(0, (int) size);
visitor = new RecursiveVisitor(new MaskIntersection(adjacent, solid, radius), funcion -> true, Integer.MAX_VALUE, editSession.getMinY(), editSession.getMaxY());
visitor.visit(position);
visitor.setDirections(Arrays.asList(BreadthFirstSearch.DIAGONAL_DIRECTIONS));
Operations.completeBlindly(visitor);
BlockVectorSet visited = visitor.getVisited();
visitor = new RecursiveVisitor(new LayerBrushMask(editSession, visitor, layers, adjacent), pos -> {
int depth = visitor.getDepth();
Pattern currentPattern = layers[depth];
return currentPattern.apply(editSession, pos, pos);
}, layers.length - 1, editSession.getMinY(), editSession.getMaxY());
for (BlockVector3 pos : visited) {
visitor.visit(pos);
}
Operations.completeBlindly(visitor);
visitor = null;
}
use of com.sk89q.worldedit.function.mask.SolidBlockMask in project FastAsyncWorldEdit by IntellectualSites.
the class RegionCommands method hollow.
@Command(name = "/hollow", desc = "Hollows out the object contained in this selection", descFooter = "Hollows out the object contained in this selection.\n" + "Optionally fills the hollowed out part with the given block.\n" + "Thickness is measured in manhattan distance.")
@CommandPermissions("worldedit.region.hollow")
@Logging(REGION)
@Preload(Preload.PreloadCheck.PRELOAD)
@Confirm(Confirm.Processor.REGION)
public int hollow(Actor actor, EditSession editSession, @Selection Region region, @Arg(desc = "Thickness of the shell to leave", def = "0") int thickness, @Arg(desc = "The pattern of blocks to replace the hollowed area with", def = "air") Pattern pattern, @ArgFlag(name = 'm', desc = "Mask to hollow with") Mask mask) throws WorldEditException {
checkCommandArgument(thickness >= 0, "Thickness must be >= 0");
// FAWE start > the mask will have been initialised with a WorldWrapper extent (very bad/slow)
Mask finalMask;
if (mask != null) {
new MaskTraverser(mask).setNewExtent(editSession);
finalMask = mask;
} else {
finalMask = new SolidBlockMask(editSession);
}
// FAWE end
int affected = editSession.hollowOutRegion(region, thickness, pattern, finalMask);
actor.print(Caption.of("worldedit.hollow.changed", TextComponent.of(affected)));
return affected;
}
Aggregations