use of com.fastasyncworldedit.core.command.tool.brush.StencilBrush in project FastAsyncWorldEdit by IntellectualSites.
the class BrushCommands method stencilBrush.
@Command(name = "stencil", desc = "Use a height map to paint a surface", descFooter = "Use a height map to paint any surface.")
@CommandPermissions("worldedit.brush.stencil")
public void stencilBrush(Player player, LocalSession session, InjectedValueAccess context, @Arg(desc = "Pattern") Pattern fill, @Arg(desc = "Expression", def = "5") Expression radius, @Arg(desc = "String", def = "") String image, @Arg(def = "0", desc = "rotation") @Range(from = 0, to = 360) int rotation, @Arg(desc = "double", def = "1") double yscale, @Switch(name = 'w', desc = "Apply at maximum saturation") boolean onlyWhite, @Switch(name = 'r', desc = "Apply random rotation") boolean randomRotate) throws WorldEditException, FileNotFoundException {
worldEdit.checkMaxBrushRadius(radius);
InputStream stream = getHeightmapStream(image);
HeightBrush brush;
int minY = player.getWorld().getMinY();
int maxY = player.getWorld().getMaxY();
try {
brush = new StencilBrush(stream, rotation, yscale, onlyWhite, "#clipboard".equalsIgnoreCase(image) ? session.getClipboard().getClipboard() : null, minY, maxY);
} catch (EmptyClipboardException ignored) {
brush = new StencilBrush(stream, rotation, yscale, onlyWhite, null, minY, maxY);
}
if (randomRotate) {
brush.setRandomRotate(true);
}
set(context, brush, "worldedit.brush.stencil").setSize(radius).setFill(fill);
}
Aggregations