Void world with schematic for minigame

Discussion in 'Spigot Plugin Development' started by Drank, May 13, 2016.

  1. Hey everyone.

    I'm making a team deathmatch but I want it to have it in a void world and then paste a schematic in. I've googled many times before making this thread, nothing works. How do I create a void world with worldedit and then when the player joins that's the main world. And then paste a schematic in it?
     
  2. You could have the player perform the command perhaps with temporary permissions as long as the paste was relative. You may be able to create a void world with multiverseAPI or empty world generator, if EWG has an api.
     
  3. MiniDigger

    Supporter

    just create a custom world generator to generate a void world. Or use multiverse, I think it has one included.
     
    • Agree Agree x 1
  4. How do you create a custom world generator?

    Sorry OP for asking this question on your thread, I promise I am not hijacking <3
     
  5. MiniDigger

    Supporter

  6. What I suggest is what I am doing in my skywars plugin. This will create no lag;

    Load the blocks of the schematics and make PlaceEntry's (block location id and data)

    then make a runnable run every 1 tick which places 40 blocks of the placeentries.

    voila no lag pasting

    useful links:
    - google how to read schematic java
    - google how to make empty world generator
     
  7. What do you mean? And like I said, I've googled.. I've used generators non of them worked, I've used reading schematics, non of them worked.

    Should I give you code of what I have now?
     
  8. I don't want to use Multiverse.
     
  9. I'll just quit with the schematics and the empty world NOTHING works.. I did everything..

    But I need a method for deleteWorlds and copyWorlds, I searched on google and non of them methods worked.
     
  10. In the second link there is this code:

    Code (Text):
    import java.util.List;
    import java.io.File;
    import java.io.FileInputStream;
    import java.io.InputStream;
    import java.util.ArrayList;
    import net.minecraft.server.v1_4_6.*;
    public class HelloWorld {
        public static void main(String[] args) {
            HelloWorld h = new HelloWorld();
            h.init();
         
        }
        public void init(){
            try {
             
                InputStream fis = getClass().getResourceAsStream("medievalhouse.schematic");
                NBTTagCompound nbtdata = NBTCompressedStreamTools.a(fis);;
             
                short width = nbtdata.getShort("Width");
                short height = nbtdata.getShort("Height");
                short length = nbtdata.getShort("Length");
                byte[] blocks = nbtdata.getByteArray("Blocks");
                byte[] data = nbtdata.getByteArray("Data");
                NBTTagList entities = nbtdata.getList("Entities");
                NBTTagList tileentities = nbtdata.getList("TileEntities");
             
                fis.close();
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    }
    you end up with and array of blocks and block data.

    You choose a location to paste the schematic, the origin.

    then you make a for loop
    Code (Text):
    Location origin = location;

    for(int x = 0; x < width;x++)
         for(int y = 0; y < height;y++)
               for(int z = 0; z < length; z++) {
                    Location place = origin.add(x, y, z);
                    place.getBlock().setTypeAndId(block[x + y + z], data[x + y + z]);
                }
    this will place the blocks in one go, you can use your intelligence to make this work with only 40 blocks per tick.
    you probably dont need to paste the entities or tileentities, so forget about that.


    For the world generator you copy the class from the first link into your project.
    then you add the generator to your world before generating it.
    you do this in the onenable to make the world. You can call the world "gameWorld" or something

    to delete a world you put this before you generate the world
    https://bukkit.org/threads/how-to-delete-a-world-folder-properly.156344/