Copy WorldEdit Selection to a World

Discussion in 'Plugin Development' started by silthus, Oct 21, 2013.

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

    silthus

    Hi,

    I am currently trying to create a plugin that can be used to instantiate worlds per player or group of players, kinda like the World of Warcraft instance system.
    I am trying to make it so that you can select a region with WorldEdit and then create a separate world out of that selection, which will be used as the "template world" and copied over if a player starts the instance.

    The problem I have is that somehow the copied world is always full of void chunks. I am using a custom WorldCreator to make new chunks void, but I dont know if this will make existing chunks void too?

    I am using the WorldCreator.copy(World) function and then a copy of the WorldBorders trim task to trim out the chunks.

    Does anyone have an idea how to make this work or how to copy and trim a world in general?



    Thanks in Advance!
     
  2. Offline

    chasechocolate

    Look into using schematics.
     
  3. Offline

    AGuyWhoSkis

    Here is the method I use:
    Code:
        public static void loadSchematic(World world, File file, Vector origin) throws DataException, IOException {
            EditSession es = new EditSession(new BukkitWorld(world), 9999);
            CuboidClipboard cc = CuboidClipboard.loadSchematic(file);
            cc.setOrigin(origin);
            try {
                cc.paste(es, origin, true);
             
            } catch (MaxChangedBlocksException e) {
                e.printStackTrace();
            }
        }
    The vector is the x,y,z values. You'll have to use worldedit as an external jar for this, by the way.
     
  4. Offline

    silthus

    chasechocolate AGuyWhoSkis

    Thanks, but I already had it working with schematics and the problem is that the selections get far too big when trying to copy over the selected dungeons. They completly lag out/crash the server.

    Selections are sometimes bigger than 500x500 blocks. Also I need a fast and clean way to copy the entire template world over, since the players would be stuck in the instance entrance for too long when I, e.g. use AsyncWorldEdit.
     
  5. Offline

    whitehooder

    If these worlds don't have to be generated every time a player enters a dungeon (or whatever is happening), you could simply generate it once, then save an original of it, and copy that for every player. I think that would be faster.
     
Thread Status:
Not open for further replies.

Share This Page