@Command( aliases = { "forestgen" }, usage = "[size] [type] [density]", desc = "Generate a forest", min = 0, max = 3 ) @CommandPermissions("worldedit.generation.forest") @Logging(POSITION) public void forestGen(Player player, LocalSession session, EditSession editSession, @Optional("10") int size, @Optional("tree") TreeType type, @Optional("5") double density) throws WorldEditException { density = density / 100; int affected = editSession.makeForest(session.getPlacementPosition(player), size, density, type); player.print(affected + " trees created."); }
@Command( aliases = { "/hollow" }, usage = "[<thickness>[ <block>]]", desc = "Hollows out the object contained in this selection", help = "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.", min = 0, max = 2 ) @CommandPermissions("worldedit.region.hollow") @Logging(REGION) public void hollow(Player player, EditSession editSession, @Selection Region region, @Optional("0") @Range(min = 0) int thickness, @Optional("air") Pattern pattern) throws WorldEditException { int affected = editSession.hollowOutRegion(region, thickness, pattern); player.print(affected + " block(s) have been changed."); }
@Command( aliases = { "/hsphere" }, usage = "<block> <radius>[,<radius>,<radius>] [raised?]", desc = "Generates a hollow sphere.", help = "Generates a hollow sphere.\n" + "By specifying 3 radii, separated by commas,\n" + "you can generate an ellipsoid. The order of the ellipsoid radii\n" + "is north/south, up/down, east/west.", min = 2, max = 3 ) @CommandPermissions("worldedit.generation.sphere") @Logging(PLACEMENT) public void hsphere(Player player, LocalSession session, EditSession editSession, Pattern pattern, String radiusString, @Optional("false") boolean raised) throws WorldEditException { sphere(player, session, editSession, pattern, radiusString, raised, true); }
@Command( aliases = { "/hcyl" }, usage = "<pattern> <radius>[,<radius>] [height]", desc = "Generates a hollow cylinder.", help = "Generates a hollow cylinder.\n" + "By specifying 2 radii, separated by a comma,\n" + "you can generate elliptical cylinders.\n" + "The 1st radius is north/south, the 2nd radius is east/west.", min = 2, max = 3 ) @CommandPermissions("worldedit.generation.cylinder") @Logging(PLACEMENT) public void hcyl(Player player, LocalSession session, EditSession editSession, Pattern pattern, String radiusString, @Optional("1") int height) throws WorldEditException { cyl(player, session, editSession, pattern, radiusString, height, true); }
@Command( aliases = { "descend", "desc" }, usage = "[# of floors]", desc = "Go down a floor", min = 0, max = 1 ) @CommandPermissions("worldedit.navigation.descend") public void descend(Player player, @Optional("1") int levelsToDescend) throws WorldEditException { int descentLevels = 0; while (player.descendLevel()) { ++descentLevels; if (levelsToDescend == descentLevels) { break; } } if (descentLevels == 0) { player.printError("No free spot below you found."); } else { player.print((descentLevels != 1) ? "Descended " + Integer.toString(descentLevels) + " levels." : "Descended a level."); } }
@Command( aliases = { "ascend", "asc" }, usage = "[# of levels]", desc = "Go up a floor", min = 0, max = 1 ) @CommandPermissions("worldedit.navigation.ascend") public void ascend(Player player, @Optional("1") int levelsToAscend) throws WorldEditException { int ascentLevels = 0; while (player.ascendLevel()) { ++ascentLevels; if (levelsToAscend == ascentLevels) { break; } } if (ascentLevels == 0) { player.printError("No free spot above you found."); } else { player.print((ascentLevels != 1) ? "Ascended " + Integer.toString(ascentLevels) + " levels." : "Ascended a level."); } }
@Command( aliases = { "smooth" }, usage = "[size] [iterations]", desc = "Choose the terrain softener brush", help = "Chooses the terrain softener brush.", min = 0, max = 2 ) @CommandPermissions("worldedit.brush.smooth") public void smoothBrush(Player player, LocalSession session, EditSession editSession, @Optional("2") double radius, @Optional("4") int iterations) throws WorldEditException { worldEdit.checkMaxBrushRadius(radius); BrushTool tool = session.getBrushTool(player.getItemInHand(HandSide.MAIN_HAND).getType()); tool.setSize(radius); tool.setBrush(new SmoothBrush(iterations), "worldedit.brush.smooth"); player.print(String.format("Smooth brush equipped (%.0f x %dx, using any block).", radius, iterations)); }
@Command( aliases = { "/rotate" }, usage = "<y-axis> [<x-axis>] [<z-axis>]", desc = "Rotate the contents of the clipboard", help = "Non-destructively rotate the contents of the clipboard.\n" + "Angles are provided in degrees and a positive angle will result in a clockwise rotation. " + "Multiple rotations can be stacked. Interpolation is not performed so angles should be a multiple of 90 degrees.\n" ) @CommandPermissions("worldedit.clipboard.rotate") public void rotate(Player player, LocalSession session, Double yRotate, @Optional Double xRotate, @Optional Double zRotate) throws WorldEditException { if ((yRotate != null && Math.abs(yRotate % 90) > 0.001) || xRotate != null && Math.abs(xRotate % 90) > 0.001 || zRotate != null && Math.abs(zRotate % 90) > 0.001) { player.printDebug("Note: Interpolation is not yet supported, so angles that are multiples of 90 is recommended."); } ClipboardHolder holder = session.getClipboard(); AffineTransform transform = new AffineTransform(); transform = transform.rotateY(-(yRotate != null ? yRotate : 0)); transform = transform.rotateX(-(xRotate != null ? xRotate : 0)); transform = transform.rotateZ(-(zRotate != null ? zRotate : 0)); holder.setTransform(holder.getTransform().combine(transform)); player.print("The clipboard copy has been rotated."); }
@Command( aliases = { "pumpkins" }, usage = "[size]", desc = "Generate pumpkin patches", min = 0, max = 1 ) @CommandPermissions("worldedit.generation.pumpkins") @Logging(POSITION) public void pumpkins(Player player, LocalSession session, EditSession editSession, @Optional("10") int apothem) throws WorldEditException { int affected = editSession.makePumpkinPatches(session.getPlacementPosition(player), apothem); player.print(affected + " pumpkin patches created."); }
@Command( aliases = { "/gmask", "gmask" }, usage = "[mask]", desc = "Set the global mask", min = 0, max = -1 ) @CommandPermissions("worldedit.global-mask") public void gmask(Player player, LocalSession session, EditSession editSession, @Optional Mask mask) throws WorldEditException { if (mask == null) { session.setMask((Mask) null); player.print("Global mask disabled."); } else { session.setMask(mask); player.print("Global mask set."); } }
@Command( aliases = { "/replace", "/re", "/rep" }, usage = "[from-block] <to-block>", desc = "Replace all blocks in the selection with another", flags = "f", min = 1, max = 2 ) @CommandPermissions("worldedit.region.replace") @Logging(REGION) public void replace(Player player, EditSession editSession, @Selection Region region, @Optional Mask from, Pattern to) throws WorldEditException { if (from == null) { from = new ExistingBlockMask(editSession); } int affected = editSession.replaceBlocks(region, from, to); player.print(affected + " block(s) have been replaced."); }
@Command( aliases = { "cylinder", "cyl", "c" }, usage = "<block> [radius] [height]", flags = "h", desc = "Choose the cylinder brush", help = "Chooses the cylinder brush.\n" + "The -h flag creates hollow cylinders instead.", min = 1, max = 3 ) @CommandPermissions("worldedit.brush.cylinder") public void cylinderBrush(Player player, LocalSession session, EditSession editSession, Pattern fill, @Optional("2") double radius, @Optional("1") int height, @Switch('h') boolean hollow) throws WorldEditException { worldEdit.checkMaxBrushRadius(radius); worldEdit.checkMaxBrushRadius(height); BrushTool tool = session.getBrushTool(player.getItemInHand(HandSide.MAIN_HAND).getType()); tool.setFill(fill); tool.setSize(radius); if (hollow) { tool.setBrush(new HollowCylinderBrush(height), "worldedit.brush.cylinder"); } else { tool.setBrush(new CylinderBrush(height), "worldedit.brush.cylinder"); } player.print(String.format("Cylinder brush shape equipped (%.0f by %d).", radius, height)); }
@Command( aliases = { "gravity", "grav" }, usage = "[radius]", flags = "h", desc = "Gravity brush", help = "This brush simulates the affect of gravity.\n" + "The -h flag makes it affect blocks starting at the world's max y, " + "instead of the clicked block's y + radius.", min = 0, max = 1 ) @CommandPermissions("worldedit.brush.gravity") public void gravityBrush(Player player, LocalSession session, EditSession editSession, @Optional("5") double radius, @Switch('h') boolean fromMaxY) throws WorldEditException { worldEdit.checkMaxBrushRadius(radius); BrushTool tool = session.getBrushTool(player.getItemInHand(HandSide.MAIN_HAND).getType()); tool.setSize(radius); tool.setBrush(new GravityBrush(fromMaxY), "worldedit.brush.gravity"); player.print(String.format("Gravity brush equipped (%.0f).", radius)); }
@Command( aliases = { "/smooth" }, usage = "[iterations]", desc = "Smooth the elevation in the selection", help = "Smooths the elevation in the selection.", min = 0, max = 1 ) @CommandPermissions("worldedit.region.smooth") @Logging(REGION) public void smooth(Player player, EditSession editSession, @Selection Region region, @Optional("1") int iterations) throws WorldEditException { HeightMap heightMap = new HeightMap(editSession, region); HeightMapFilter filter = new HeightMapFilter(new GaussianKernel(5, 1.0)); int affected = heightMap.applyFilter(filter, iterations); player.print("Terrain's height map smoothed. " + affected + " block(s) changed."); }
@Command( aliases = { "ex", "extinguish" }, usage = "[radius]", desc = "Shortcut fire extinguisher brush", min = 0, max = 1 ) @CommandPermissions("worldedit.brush.ex") public void extinguishBrush(Player player, LocalSession session, EditSession editSession, @Optional("5") double radius) throws WorldEditException { worldEdit.checkMaxBrushRadius(radius); BrushTool tool = session.getBrushTool(player.getItemInHand(HandSide.MAIN_HAND).getType()); Pattern fill = new BlockPattern(BlockTypes.AIR.getDefaultState()); tool.setFill(fill); tool.setSize(radius); tool.setMask(new BlockTypeMask(editSession, BlockTypes.FIRE)); tool.setBrush(new SphereBrush(), "worldedit.brush.ex"); player.print(String.format("Extinguisher equipped (%.0f).", radius)); }
@Command( aliases = { "/forest" }, usage = "[type] [density]", desc = "Make a forest within the region", min = 0, max = 2 ) @CommandPermissions("worldedit.region.forest") @Logging(REGION) public void forest(Player player, EditSession editSession, @Selection Region region, @Optional("tree") TreeType type, @Optional("5") @Range(min = 0, max = 100) double density) throws WorldEditException { density = density / 100; ForestGenerator generator = new ForestGenerator(editSession, type); GroundFunction ground = new GroundFunction(new ExistingBlockMask(editSession), generator); LayerVisitor visitor = new LayerVisitor(asFlatRegion(region), minimumBlockY(region), maximumBlockY(region), ground); visitor.setMask(new NoiseFilter2D(new RandomNoise(), density)); Operations.completeLegacy(visitor); player.print(ground.getAffected() + " trees created."); }
@Command( aliases = { "sphere", "s" }, usage = "<pattern> [radius]", flags = "h", desc = "Choose the sphere brush", help = "Chooses the sphere brush.\n" + "The -h flag creates hollow spheres instead.", min = 1, max = 2 ) @CommandPermissions("worldedit.brush.sphere") public void sphereBrush(Player player, LocalSession session, EditSession editSession, Pattern fill, @Optional("2") double radius, @Switch('h') boolean hollow) throws WorldEditException { worldEdit.checkMaxBrushRadius(radius); BrushTool tool = session.getBrushTool(player.getItemInHand(HandSide.MAIN_HAND).getType()); tool.setFill(fill); tool.setSize(radius); if (hollow) { tool.setBrush(new HollowSphereBrush(), "worldedit.brush.sphere"); } else { tool.setBrush(new SphereBrush(), "worldedit.brush.sphere"); } player.print(String.format("Sphere brush shape equipped (%.0f).", radius)); }
@Command( aliases = { "mask" }, usage = "[mask]", desc = "Set the brush mask", min = 0, max = -1 ) @CommandPermissions("worldedit.brush.options.mask") public void mask(Player player, LocalSession session, EditSession editSession, @Optional Mask mask) throws WorldEditException { if (mask == null) { session.getBrushTool(player.getItemInHand(HandSide.MAIN_HAND).getType()).setMask(null); player.print("Brush mask disabled."); } else { session.getBrushTool(player.getItemInHand(HandSide.MAIN_HAND).getType()).setMask(mask); player.print("Brush mask set."); } }
@Command( aliases = { "/flip" }, usage = "[<direction>]", desc = "Flip the contents of the clipboard", help = "Flips the contents of the clipboard across the point from which the copy was made.\n", min = 0, max = 1 ) @CommandPermissions("worldedit.clipboard.flip") public void flip(Player player, LocalSession session, EditSession editSession, @Optional(Direction.AIM) @Direction BlockVector3 direction) throws WorldEditException { ClipboardHolder holder = session.getClipboard(); AffineTransform transform = new AffineTransform(); transform = transform.scale(direction.abs().multiply(-2).add(1, 1, 1).toVector3()); holder.setTransform(holder.getTransform().combine(transform)); player.print("The clipboard copy has been flipped."); }
@Command( aliases = { "/flora" }, usage = "[density]", desc = "Make flora within the region", min = 0, max = 1 ) @CommandPermissions("worldedit.region.flora") @Logging(REGION) public void flora(Player player, EditSession editSession, @Selection Region region, @Optional("10") @Range(min = 0, max = 100) double density) throws WorldEditException { density = density / 100; FloraGenerator generator = new FloraGenerator(editSession); GroundFunction ground = new GroundFunction(new ExistingBlockMask(editSession), generator); LayerVisitor visitor = new LayerVisitor(asFlatRegion(region), minimumBlockY(region), maximumBlockY(region), ground); visitor.setMask(new NoiseFilter2D(new RandomNoise(), density)); Operations.completeLegacy(visitor); player.print(ground.getAffected() + " flora created."); }