Skip to content

AsyncWorld

Jesse Boyd edited this page Mar 1, 2018 · 7 revisions

The AsyncWorld implements the Bukkit World interface and allows you to asynchronously access or make changes to the world.

  • Most objects obtained from an instance can be used async (location, block, chunk etc.)
  • Only block and biome manipulation is optimized for the queue
  • Other operations will be slower when used async
  • You can use AsyncWorld.create(...) to load a world async

Note: The AsyncWorld class is only present in FastAsyncWorldEdit-bukkit, not the API.

TaskManager.IMP.async(new Runnable() {
    @Override
    public void run() {
        // Create or load a world async with the provided WorldCreator settings
        AsyncWorld world = AsyncWorld.create(new WorldCreator("MyWorld"));
        // AsyncWorld world = AsyncWorld.wrap(bukkitWorld); // Or wrap existing world
        Block block = world.getBlockAt(0, 0, 0);
        block.setType(Material.BEDROCK);
        // When you are done
        world.commit();
    }
});

Source: https://github.com/boy0001/FastAsyncWorldedit/blob/master/bukkit/src/main/java/com/boydti/fawe/bukkit/wrapper/AsyncWorld.java#L66

Notes on async performance

https://github.com/boy0001/FastAsyncWorldedit/wiki/Notes-on-async-performance And: https://github.com/boy0001/FastAsyncWorldedit/wiki/Fawe-TaskManager#sync-task