Search in sources :

Example 1 with RegenOptions

use of com.sk89q.worldedit.world.RegenOptions in project FastAsyncWorldEdit by IntellectualSites.

the class RegionCommands method regenerate.

@Command(name = "/regen", desc = "Regenerates the contents of the selection", descFooter = "This command might affect things outside the selection,\n" + "if they are within the same chunk.")
@CommandPermissions("worldedit.regen")
@Logging(REGION)
@Confirm(Confirm.Processor.REGION)
void regenerate(Actor actor, World world, LocalSession session, EditSession editSession, @Selection Region region, @Arg(desc = "The seed to regenerate with, otherwise uses world seed", def = "") Long seed, @Switch(name = 'b', desc = "Regenerate biomes as well") boolean regenBiomes, @Arg(desc = "Biome to apply for this regeneration (only works in overworld)", def = "") BiomeType biomeType) throws WorldEditException {
    Mask mask = session.getMask();
    boolean success;
    try {
        session.setMask(null);
        // FAWE start
        session.setSourceMask(null);
        actor.print(Caption.of("fawe.regen.time"));
        // FAWE end
        RegenOptions options = RegenOptions.builder().seed(seed).regenBiomes(regenBiomes).biomeType(biomeType).build();
        success = world.regenerate(region, editSession, options);
    } finally {
        session.setMask(mask);
        // FAWE start
        session.setSourceMask(mask);
    // FAWE end
    }
    if (success) {
        actor.print(Caption.of("worldedit.regen.regenerated"));
    } else {
        actor.print(Caption.of("worldedit.regen.failed"));
    }
}
Also used : SolidBlockMask(com.sk89q.worldedit.function.mask.SolidBlockMask) ExistingBlockMask(com.sk89q.worldedit.function.mask.ExistingBlockMask) Mask(com.sk89q.worldedit.function.mask.Mask) RegenOptions(com.sk89q.worldedit.world.RegenOptions) 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)

Aggregations

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 ExistingBlockMask (com.sk89q.worldedit.function.mask.ExistingBlockMask)1 Mask (com.sk89q.worldedit.function.mask.Mask)1 SolidBlockMask (com.sk89q.worldedit.function.mask.SolidBlockMask)1 RegenOptions (com.sk89q.worldedit.world.RegenOptions)1 Command (org.enginehub.piston.annotation.Command)1