Search in sources :

Example 46 with Logging

use of com.sk89q.worldedit.command.util.Logging 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;
}
Also used : SolidBlockMask(com.sk89q.worldedit.function.mask.SolidBlockMask) ExistingBlockMask(com.sk89q.worldedit.function.mask.ExistingBlockMask) Mask(com.sk89q.worldedit.function.mask.Mask) SolidBlockMask(com.sk89q.worldedit.function.mask.SolidBlockMask) MaskTraverser(com.fastasyncworldedit.core.util.MaskTraverser) Logging(com.sk89q.worldedit.command.util.Logging) Preload(com.sk89q.worldedit.command.util.annotation.Preload) Command(org.enginehub.piston.annotation.Command) Confirm(com.sk89q.worldedit.command.util.annotation.Confirm) CommandPermissions(com.sk89q.worldedit.command.util.CommandPermissions)

Example 47 with Logging

use of com.sk89q.worldedit.command.util.Logging in project FastAsyncWorldEdit by IntellectualSites.

the class ExpandCommands method expand.

@org.enginehub.piston.annotation.Command(name = "/expand", desc = "Expand the selection area")
@Logging(REGION)
public void expand(Actor actor, World world, LocalSession session, @Arg(desc = "Amount to expand the selection by, can be `vert` to expand to the whole vertical column") int amount, @Arg(desc = "Amount to expand the selection by in the other direction", def = "0") int reverseAmount, @Arg(desc = "Direction to expand", def = Direction.AIM) @MultiDirection List<BlockVector3> direction) throws WorldEditException {
    Region region = session.getSelection(world);
    long oldSize = region.getVolume();
    if (reverseAmount == 0) {
        for (BlockVector3 dir : direction) {
            region.expand(dir.multiply(amount));
        }
    } else {
        for (BlockVector3 dir : direction) {
            region.expand(dir.multiply(amount), dir.multiply(-reverseAmount));
        }
    }
    session.getRegionSelector(world).learnChanges();
    long newSize = region.getVolume();
    session.getRegionSelector(world).explainRegionAdjust(actor, session);
    long changeSize = newSize - oldSize;
    actor.print(Caption.of("worldedit.expand.expanded", TextComponent.of(changeSize)));
}
Also used : Region(com.sk89q.worldedit.regions.Region) BlockVector3(com.sk89q.worldedit.math.BlockVector3) Logging(com.sk89q.worldedit.command.util.Logging)

Aggregations

Logging (com.sk89q.worldedit.command.util.Logging)47 CommandPermissions (com.sk89q.worldedit.command.util.CommandPermissions)45 Command (org.enginehub.piston.annotation.Command)45 BlockVector3 (com.sk89q.worldedit.math.BlockVector3)25 Confirm (com.sk89q.worldedit.command.util.annotation.Confirm)17 Preload (com.sk89q.worldedit.command.util.annotation.Preload)15 Region (com.sk89q.worldedit.regions.Region)13 MaskTraverser (com.fastasyncworldedit.core.util.MaskTraverser)10 ExistingBlockMask (com.sk89q.worldedit.function.mask.ExistingBlockMask)8 Mask (com.sk89q.worldedit.function.mask.Mask)7 Player (com.sk89q.worldedit.entity.Player)6 CuboidRegion (com.sk89q.worldedit.regions.CuboidRegion)5 Locatable (com.sk89q.worldedit.extension.platform.Locatable)4 SolidBlockMask (com.sk89q.worldedit.function.mask.SolidBlockMask)4 Vector3 (com.sk89q.worldedit.math.Vector3)4 MultiClipboardHolder (com.fastasyncworldedit.core.extent.clipboard.MultiClipboardHolder)3 URIClipboardHolder (com.fastasyncworldedit.core.extent.clipboard.URIClipboardHolder)3 LocalConfiguration (com.sk89q.worldedit.LocalConfiguration)3 BlockArrayClipboard (com.sk89q.worldedit.extent.clipboard.BlockArrayClipboard)3 RegionOperationException (com.sk89q.worldedit.regions.RegionOperationException)3