use of com.sk89q.worldedit.extent.clipboard.io.BuiltInClipboardFormat in project Histeria by zelytra.
the class LuckyBlock method WEgenerate.
private void WEgenerate(World world, String fileName, double locX, double locY, double locZ) {
// Load the file selected
InputStream is = Histeria.getInstance().getResource("luckyBlock/" + fileName + ".schem");
BuiltInClipboardFormat format = BuiltInClipboardFormat.SPONGE_SCHEMATIC;
Clipboard clipboard = null;
try (ClipboardReader reader = format.getReader(is)) {
clipboard = reader.read();
} catch (IOException e) {
e.printStackTrace();
}
try (EditSession editSession = WorldEdit.getInstance().getEditSessionFactory().getEditSession(world, -1)) {
Operation operation = new ClipboardHolder(clipboard).createPaste(editSession).to(BlockVector3.at(locX, locY, locZ)).ignoreAirBlocks(true).build();
Operations.complete(operation);
} catch (WorldEditException e) {
e.printStackTrace();
}
}
Aggregations