-
Notifications
You must be signed in to change notification settings - Fork 225
Pasting a schematic
0xLyptox | Lars edited this page Jul 18, 2019
·
10 revisions
boolean allowUndo = true;
EditSession editSession = ClipboardFormats.findByFile(file).load(file).paste(world, position, allowUndo, !noAir, (Transform) null);
File file = new File("mySchem.schematic");
Vector bot = new Vector(0, 0, 0); //MUST be a whole number eg integer
Vector top = new Vector(50, 255, 50); //MUST be a whole number eg integer
CuboidRegion region = new CuboidRegion(new BukkitWorld(world), bot, top);
Schematic schem = new Schematic(region);
schem.save(file, ClipboardFormat.SCHEMATIC);
File file = new File("myFile"); // The schematic file
Vector to = new Vector(0, 0, 0); // Where you want to paste
World weWorld = new BukkitWorld(world);
WorldData worldData = weWorld.getWorldData();
Clipboard clipboard = ClipboardFormat.SCHEMATIC.getReader(new FileInputStream(file)).read(worldData);
Region region = clipboard.getRegion();
EditSession extent = WorldEdit.getInstance().getEditSessionFactory().getEditSession(weWorld, -1);
AffineTransform transform = new AffineTransform();
//{ // Uncomment this if you want to rotate the schematic
// transform = transform.rotateY(90); // E.g. Rotate 90
// extent = new BlockTransformExtent(clipboard, transform, worldData.getBlockRegistry());
//}
ForwardExtentCopy copy = new ForwardExtentCopy(clipboard, clipboard.getRegion(), clipboard.getOrigin(), extent, to);
if (!transform.isIdentity()) copy.setTransform(transform);
if (ignoreAirBlocks) {
copy.setSourceMask(new ExistingBlockMask(clipboard));
}
Operations.completeLegacy(copy);
extent.flushQueue();
This wiki is outdated, move to https://github.com/IntellectualSites/FastAsyncWorldEdit-Documentation/
This Wiki is for Legacy Versions (1.8 - 1.12.2). Check here for 1.13+ versions: https://github.com/IntellectualSites/FastAsyncWorldEdit-Documentation/