/** * Fills an area recursively in the X/Z directions. * * @param origin the location to start from * @param block the block to fill with * @param radius the radius of the spherical area to fill * @param depth the maximum depth, starting from the origin * @param recursive whether a breadth-first search should be performed * @return number of blocks affected * @throws MaxChangedBlocksException thrown if too many blocks are changed */ public <B extends BlockStateHolder<B>> int fillXZ(BlockVector3 origin, B block, double radius, int depth, boolean recursive) throws MaxChangedBlocksException { return fillXZ(origin, new BlockPattern(block), radius, depth, recursive); }
@Command( aliases = { "/fillr" }, usage = "<block> <radius> [depth]", desc = "Fill a hole recursively", min = 2, max = 3 ) @CommandPermissions("worldedit.fill.recursive") @Logging(PLACEMENT) public void fillr(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException { ParserContext context = new ParserContext(); context.setActor(player); context.setWorld(player.getWorld()); context.setSession(session); Pattern pattern = we.getPatternFactory().parseFromInput(args.getString(0), context); double radius = Math.max(1, args.getDouble(1)); we.checkMaxRadius(radius); int depth = args.argsLength() > 2 ? Math.max(1, args.getInteger(2)) : Integer.MAX_VALUE; BlockVector3 pos = session.getPlacementPosition(player); int affected = 0; if (pattern instanceof BlockPattern) { affected = editSession.fillXZ(pos, ((BlockPattern) pattern).getBlock(), radius, depth, true); } else { affected = editSession.fillXZ(pos, pattern, radius, depth, true); } player.print(affected + " block(s) have been created."); }
@Command( aliases = { "/fill" }, usage = "<block> <radius> [depth]", desc = "Fill a hole", min = 2, max = 3 ) @CommandPermissions("worldedit.fill") @Logging(PLACEMENT) public void fill(Player player, LocalSession session, EditSession editSession, CommandContext args) throws WorldEditException { ParserContext context = new ParserContext(); context.setActor(player); context.setWorld(player.getWorld()); context.setSession(session); Pattern pattern = we.getPatternFactory().parseFromInput(args.getString(0), context); double radius = Math.max(1, args.getDouble(1)); we.checkMaxRadius(radius); int depth = args.argsLength() > 2 ? Math.max(1, args.getInteger(2)) : 1; BlockVector3 pos = session.getPlacementPosition(player); int affected = editSession.fillXZ(pos, pattern, radius, depth, false); player.print(affected + " block(s) have been created."); }