use of com.sk89q.worldedit.function.FlatRegionFunction in project FastAsyncWorldEdit by IntellectualSites.
the class FaweDelegateRegionManager method setBiome.
public void setBiome(CuboidRegion region, int extendBiome, BiomeType biome, String world, Runnable whenDone) {
region.expand(BlockVector3.at(extendBiome, 0, extendBiome));
region.expand(BlockVector3.at(-extendBiome, 0, -extendBiome));
TaskManager.taskManager().async(() -> {
synchronized (FaweDelegateRegionManager.class) {
EditSession editSession = WorldEdit.getInstance().newEditSessionBuilder().world(BukkitAdapter.adapt(getWorld(world))).checkMemory(false).fastMode(true).limitUnlimited().changeSetNull().build();
FlatRegionFunction replace = new BiomeReplace(editSession, biome);
FlatRegionVisitor visitor = new FlatRegionVisitor(region, replace, editSession);
try {
Operations.completeLegacy(visitor);
editSession.flushQueue();
} catch (MaxChangedBlocksException e) {
e.printStackTrace();
}
if (whenDone != null) {
TaskManager.taskManager().task(whenDone);
}
}
});
}
Aggregations