So I am trying to paste a schematic using FastAsyncWorldEdit (using the API, not in-game commands), and I am attempting to paste it WITHOUT air blocks. I have tried: schem.paste(paste, vector, false); Where "false" supposedly does not include air blocks, however, using both false & true, it always pastes air blocks. Any idea why this is or what I can do to fix it? Also, perhaps you have a solution, @TheMode911 since you were very helpful in my previous thread regarding fawe?
I'm going to be that person, what should air be replaced with? the only empty block there is is air so if you paste it where there is air, there's going to be air >.>
Sorry xD What I meant is that when it is pasting, it should not override any existing blocks with air found in the schematic. I want exactly what happens when you do //paste -a in worldedit.
Could you send the schem variable declaration? Have you tried these ways https://github.com/boy0001/FastAsyncWorldedit/wiki/Pasting-a-schematic ?
Here's the whole method: Code (Java): public static void copyPaste(World world, Location loc1, Location loc2, Location loc3, boolean includeAir) { EditSession copy = new EditSessionBuilder(world.getName()).autoQueue(false).build(); EditSession paste = new EditSessionBuilder(world.getName()).build(); Vector pos1 = new Vector(loc1.getBlockX(), loc1.getBlockY(), loc1.getBlockZ()); Vector pos2 = new Vector(loc2.getBlockX(), loc2.getBlockY(), loc2.getBlockZ()); CuboidRegion copyRegion = new CuboidRegion(pos1, pos2); BlockArrayClipboard lazyCopy = copy.lazyCopy(copyRegion); Schematic schem = new Schematic(lazyCopy); schem.paste(paste, new Vector(loc3.getBlockX(), loc3.getBlockY(), loc3.getBlockZ()), includeAir); paste.flushQueue(); } Also, the link you sent wouldn't work because, I don't have an actual file to use, it's just a Schematic object.
It takes resources to set an air block to air. Its much faster to check if a block is air and then not paste it.
lol that's not the issue, FAWE is handling all of that, but I'm trying to have it ignore air blocks when it pastes a schematic.
Here is the code used for that method in the Schematic object if that's helpful at all (here: https://github.com/boy0001/FastAsyn...m/boydti/fawe/object/schematic/Schematic.java) Code (Java): public void paste(Extent extent, Vector to, final boolean pasteAir) { Region region = clipboard.getRegion().clone(); final int maxY = extent.getMaximumPoint().getBlockY(); final Vector bot = clipboard.getMinimumPoint(); final Vector origin = clipboard.getOrigin(); final boolean copyBiomes = !(clipboard instanceof BlockArrayClipboard) || ((BlockArrayClipboard) clipboard).IMP.hasBiomes(); // Optimize for BlockArrayClipboard if (clipboard instanceof BlockArrayClipboard && region instanceof CuboidRegion) { // To is relative to the world origin (player loc + small clipboard offset) (As the positions supplied are relative to the clipboard min) final int relx = to.getBlockX() + bot.getBlockX() - origin.getBlockX(); final int rely = to.getBlockY() + bot.getBlockY() - origin.getBlockY(); final int relz = to.getBlockZ() + bot.getBlockZ() - origin.getBlockZ(); BlockArrayClipboard bac = (BlockArrayClipboard) clipboard; if (copyBiomes) { bac.IMP.forEach(new FaweClipboard.BlockReader() { MutableBlockVector2D mpos2d = new MutableBlockVector2D(); { mpos2d.setComponents(Integer.MIN_VALUE, Integer.MIN_VALUE); } @Override public void run(int x, int y, int z, BaseBlock block) { try { int xx = x + relx; int zz = z + relz; if (xx != mpos2d.getBlockX() || zz != mpos2d.getBlockZ()) { mpos2d.setComponents(xx, zz); extent.setBiome(mpos2d, bac.IMP.getBiome(x, z)); } if (!pasteAir && block.getId() == 0) { return; } extent.setBlock(xx, y + rely, zz, block); } catch (WorldEditException e) { throw new RuntimeException(e);} } }, true); } else { bac.IMP.forEach(new FaweClipboard.BlockReader() { @Override public void run(int x, int y, int z, BaseBlock block) { try { extent.setBlock(x + relx, y + rely, z + relz, block); } catch (WorldEditException e) { throw new RuntimeException(e);} } }, pasteAir); } } else { // To must be relative to the clipboard origin ( player location - clipboard origin ) (as the locations supplied are relative to the world origin) final int relx = to.getBlockX() - origin.getBlockX(); final int rely = to.getBlockY() - origin.getBlockY(); final int relz = to.getBlockZ() - origin.getBlockZ(); RegionVisitor visitor = new RegionVisitor(region, new RegionFunction() { MutableBlockVector2D mpos2d_2 = new MutableBlockVector2D(); MutableBlockVector2D mpos2d = new MutableBlockVector2D(); { mpos2d.setComponents(Integer.MIN_VALUE, Integer.MIN_VALUE); } @Override public boolean apply(Vector mutable) throws WorldEditException { BaseBlock block = clipboard.getBlock(mutable); int xx = mutable.getBlockX() + relx; int zz = mutable.getBlockZ() + relz; if (copyBiomes && xx != mpos2d.getBlockX() && zz != mpos2d.getBlockZ()) { mpos2d.setComponents(xx, zz); extent.setBiome(mpos2d, clipboard.getBiome(mpos2d_2.setComponents(mutable.getBlockX(), mutable.getBlockZ()))); } if (!pasteAir && block.getId() == 0) { return false; } extent.setBlock(xx, mutable.getBlockY() + rely, zz, block); return false; } }, (HasFaweQueue) (null)); Operations.completeBlindly(visitor); } // Entity offset is the paste location subtract the clipboard origin (entity's location is already relative to the world origin) final int entityOffsetX = to.getBlockX() - origin.getBlockX(); final int entityOffsetY = to.getBlockY() - origin.getBlockY(); final int entityOffsetZ = to.getBlockZ() - origin.getBlockZ(); // entities for (Entity entity : clipboard.getEntities()) { Location pos = entity.getLocation(); Location newPos = new Location(pos.getExtent(), pos.getX() + entityOffsetX, pos.getY() + entityOffsetY, pos.getZ() + entityOffsetZ, pos.getYaw(), pos.getPitch()); extent.createEntity(newPos, entity.getState()); } }
See the apply(vector) method, it returns false properly if block is air, try to copy all of this and debug maybe
Copy/paste all the "paste" method to your current class, and debug the apply(vector) method, to see why it is setting air block