Search in sources :

Example 1 with ConvexPolyhedralRegion

use of com.sk89q.worldedit.regions.ConvexPolyhedralRegion in project FastAsyncWorldEdit by IntellectualSites.

the class RegionCommands method curve.

@Command(name = "/curve", desc = "Draws a spline through selected points", descFooter = "Can only be used with a convex polyhedral selection")
@CommandPermissions("worldedit.region.curve")
@Logging(REGION)
@Confirm(Confirm.Processor.REGION)
public int curve(Actor actor, EditSession editSession, @Selection Region region, @Arg(desc = "The pattern of blocks to place") Pattern pattern, @Arg(desc = "The thickness of the curve", def = "0") int thickness, @Switch(name = 'h', desc = "Generate only a shell") boolean shell) throws WorldEditException {
    if (!(region instanceof ConvexPolyhedralRegion)) {
        actor.print(Caption.of("worldedit.curve.invalid-type"));
        return 0;
    }
    checkCommandArgument(thickness >= 0, "Thickness must be >= 0");
    ConvexPolyhedralRegion cpregion = (ConvexPolyhedralRegion) region;
    List<BlockVector3> vectors = new ArrayList<>(cpregion.getVertices());
    int blocksChanged = editSession.drawSpline(pattern, vectors, 0, 0, 0, 10, thickness, !shell);
    actor.print(Caption.of("worldedit.curve.changed", TextComponent.of(blocksChanged)));
    return blocksChanged;
}
Also used : ConvexPolyhedralRegion(com.sk89q.worldedit.regions.ConvexPolyhedralRegion) ArrayList(java.util.ArrayList) BlockVector3(com.sk89q.worldedit.math.BlockVector3) Logging(com.sk89q.worldedit.command.util.Logging) Command(org.enginehub.piston.annotation.Command) Confirm(com.sk89q.worldedit.command.util.annotation.Confirm) CommandPermissions(com.sk89q.worldedit.command.util.CommandPermissions)

Example 2 with ConvexPolyhedralRegion

use of com.sk89q.worldedit.regions.ConvexPolyhedralRegion in project FastAsyncWorldEdit by IntellectualSites.

the class AbstractPlayerActor method setSelection.

@Override
public void setSelection(Region region) {
    RegionSelector selector;
    if (region instanceof ConvexPolyhedralRegion) {
        selector = new ConvexPolyhedralRegionSelector((ConvexPolyhedralRegion) region);
    } else if (region instanceof CylinderRegion) {
        selector = new CylinderRegionSelector((CylinderRegion) region);
    } else if (region instanceof Polygonal2DRegion) {
        selector = new Polygonal2DRegionSelector((Polygonal2DRegion) region);
    } else {
        selector = new CuboidRegionSelector(null, region.getMinimumPoint(), region.getMaximumPoint());
    }
    selector.setWorld(region.getWorld());
    getSession().setRegionSelector(getWorld(), selector);
}
Also used : CuboidRegionSelector(com.sk89q.worldedit.regions.selector.CuboidRegionSelector) CylinderRegionSelector(com.sk89q.worldedit.regions.selector.CylinderRegionSelector) Polygonal2DRegionSelector(com.sk89q.worldedit.regions.selector.Polygonal2DRegionSelector) ConvexPolyhedralRegionSelector(com.sk89q.worldedit.regions.selector.ConvexPolyhedralRegionSelector) RegionSelector(com.sk89q.worldedit.regions.RegionSelector) ConvexPolyhedralRegionSelector(com.sk89q.worldedit.regions.selector.ConvexPolyhedralRegionSelector) Polygonal2DRegion(com.sk89q.worldedit.regions.Polygonal2DRegion) Polygonal2DRegionSelector(com.sk89q.worldedit.regions.selector.Polygonal2DRegionSelector) ConvexPolyhedralRegion(com.sk89q.worldedit.regions.ConvexPolyhedralRegion) CylinderRegion(com.sk89q.worldedit.regions.CylinderRegion) CylinderRegionSelector(com.sk89q.worldedit.regions.selector.CylinderRegionSelector) CuboidRegionSelector(com.sk89q.worldedit.regions.selector.CuboidRegionSelector)

Aggregations

ConvexPolyhedralRegion (com.sk89q.worldedit.regions.ConvexPolyhedralRegion)2 CommandPermissions (com.sk89q.worldedit.command.util.CommandPermissions)1 Logging (com.sk89q.worldedit.command.util.Logging)1 Confirm (com.sk89q.worldedit.command.util.annotation.Confirm)1 BlockVector3 (com.sk89q.worldedit.math.BlockVector3)1 CylinderRegion (com.sk89q.worldedit.regions.CylinderRegion)1 Polygonal2DRegion (com.sk89q.worldedit.regions.Polygonal2DRegion)1 RegionSelector (com.sk89q.worldedit.regions.RegionSelector)1 ConvexPolyhedralRegionSelector (com.sk89q.worldedit.regions.selector.ConvexPolyhedralRegionSelector)1 CuboidRegionSelector (com.sk89q.worldedit.regions.selector.CuboidRegionSelector)1 CylinderRegionSelector (com.sk89q.worldedit.regions.selector.CylinderRegionSelector)1 Polygonal2DRegionSelector (com.sk89q.worldedit.regions.selector.Polygonal2DRegionSelector)1 ArrayList (java.util.ArrayList)1 Command (org.enginehub.piston.annotation.Command)1