1 Copying a region to another world.
Jesse Boyd edited this page 2017-03-31 06:47:48 +11:00

Some example code for copying a region from one world to another.

If the worlds will not be in use, the Anvil API can do this faster:

EditSession copyWorld = new EditSessionBuilder("world").autoQueue(false).build(); // See https://github.com/boy0001/FastAsyncWorldedit/wiki/WorldEdit-EditSession
EditSession pasteWorld = new EditSessionBuilder("newWorld").build(); // See https://github.com/boy0001/FastAsyncWorldedit/wiki/WorldEdit-EditSession
Vector pos1 = new Vector(10, 3, 10);
Vector pos2 = new Vector(50, 90, 50);
CuboidRegion copyRegion = new CuboidRegion(pos1, pos2);

BlockArrayClipboard lazyCopy = copyWorld.lazyCopy(copyRegion);

Schematic schem = new Schematic(lazyCopy);
boolean pasteAir = true;
Vector to = new Vector(30, 10, 30);
schem.paste(pasteWorld, to, pasteAir);
pasteWorld.flushQueue();