Getting rid of air in world edit pastes

Discussion in 'Plugin Development' started by Chintzi, Jul 21, 2016.

Thread Status:
Not open for further replies.
  1. Offline


    So I've found a way to successfully paste a schematic file using worldedit and what I'm using these schematics for are custom structures generations but i have a problem i need to remove the air in the schematic, now obviously you can't legitimately remove 'air' but is there a way i can get all the blocks in the schematic and check if they are air and if so then get their location and set the block type to the block already there if that makes sense?

    Code if it helps:
    Pasting a Schematic file (open)

    private void loadArea(World world, File file, Vector origin) throws DataException, IOException, MaxChangedBlocksException, {
            EditSession es = new EditSession(new BukkitWorld(world), 999999999);
            CuboidClipboard cc = CuboidClipboard.loadSchematic(file);
            cc.paste(es, origin, false);

    Summary: Basically get the original blocks before the paste and don't change them if the schematic loads an air block at their location.
  2. Offline


    cc.paste(es, origin, true) is what you are looking for ;)
  3. Offline


    Wow are you serious xD ill give this a try haha thank you

    Mind you i just thought what happens when i paste this and its e.g. an underground house? would it be possible to apply the noAir effect then just put gold blocks where i want air to be then get all the blocks and replace gold_block with air?
  4. Offline


    the boolean in cc.paste is just the noAir attribute which you can use ingame with //paste -a. For the second thing you want, you would have to iterate over the whole selection and check if its gold, or simulate the //replace command, but i never tried one of this.
  5. Offline


    @Lordloss Hmm ok is there any way to get the 2 opposite points of the schematic, if i could just get the 2 opposite points i can manage the rest from there
  6. Offline


    Maybe you can get it from the CuboidClipboard, but im not sure about this.
Thread Status:
Not open for further replies.

Share This Page