Search in sources :

Example 1 with PopulateSchem

use of com.fastasyncworldedit.core.command.tool.brush.PopulateSchem in project FastAsyncWorldEdit by IntellectualSites.

the class BrushCommands method scatterSchemBrush.

@Command(name = "populateschematic", aliases = { "populateschem", "popschem", "pschem", "ps" }, desc = "Scatter a schematic on a surface")
@CommandPermissions("worldedit.brush.populateschematic")
public void scatterSchemBrush(Player player, InjectedValueAccess context, @Arg(desc = "Mask") Mask mask, @Arg(name = "clipboard", desc = "Clipboard uri") String clipboardStr, @Arg(desc = "Expression", def = "30") Expression radius, @Arg(desc = "double", def = "50") double density, @Switch(name = 'r', desc = "Apply random rotation") boolean rotate) throws WorldEditException {
    worldEdit.checkMaxBrushRadius(radius);
    try {
        MultiClipboardHolder clipboards = ClipboardFormats.loadAllFromInput(player, clipboardStr, null, true);
        if (clipboards == null) {
            player.print(Caption.of("fawe.error.schematic.not.found", clipboardStr));
            return;
        }
        List<ClipboardHolder> holders = clipboards.getHolders();
        if (holders == null) {
            player.print(Caption.of("fawe.error.schematic.not.found", clipboardStr));
            return;
        }
        set(context, new PopulateSchem(mask, holders, (int) density, rotate), "worldedit.brush.populateschematic").setSize(radius);
    } catch (IOException e) {
        throw new RuntimeException(e);
    }
}
Also used : MultiClipboardHolder(com.fastasyncworldedit.core.extent.clipboard.MultiClipboardHolder) PopulateSchem(com.fastasyncworldedit.core.command.tool.brush.PopulateSchem) MultiClipboardHolder(com.fastasyncworldedit.core.extent.clipboard.MultiClipboardHolder) ClipboardHolder(com.sk89q.worldedit.session.ClipboardHolder) IOException(java.io.IOException) ScatterCommand(com.fastasyncworldedit.core.command.tool.brush.ScatterCommand) Command(org.enginehub.piston.annotation.Command) CommandPermissions(com.sk89q.worldedit.command.util.CommandPermissions)

Aggregations

PopulateSchem (com.fastasyncworldedit.core.command.tool.brush.PopulateSchem)1 ScatterCommand (com.fastasyncworldedit.core.command.tool.brush.ScatterCommand)1 MultiClipboardHolder (com.fastasyncworldedit.core.extent.clipboard.MultiClipboardHolder)1 CommandPermissions (com.sk89q.worldedit.command.util.CommandPermissions)1 ClipboardHolder (com.sk89q.worldedit.session.ClipboardHolder)1 IOException (java.io.IOException)1 Command (org.enginehub.piston.annotation.Command)1