@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); BBC.COMMAND_FLORA.send(player, ground.getAffected()); }
@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, new TreeGenerator(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); BBC.COMMAND_TREE.send(player, ground.getAffected()); }