Generating empty worlds

Discussion in 'Plugin Development' started by Gopaintman, Jan 4, 2014.

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

    Gopaintman

    Hi,
    I'm attempting to code a skyblock-ish plugin. I need to generate an empty world, however I do not wish to make my plugin dependent on third party plugins, thus how would I go about having my plugin generate an empty world?
     
  2. Offline

    RawCode

  3. Offline

    Gopaintman

    So I have this
    Code:java
    1. public World getCastleWorld(){
    2. if(castleWorld == null){
    3. castleWorld = WorldCreator.name(ConfigSettings.worldName)
    4. .type(WorldType.FLAT).environment(World.Environment.NORMAL)
    5. .generator(new EmptyLandGenerator()).createWorld();
    6. if (Bukkit.getServer().getPluginManager()
    7. .isPluginEnabled("Multiverse-Core")) {
    8. Bukkit.getServer().dispatchCommand(
    9. Bukkit.getConsoleSender(),
    10. "mv import " + ConfigSettings.worldName
    11. + " normal -g uSkyBlock");
    12. }
    13. }
    14. return castleWorld;
    15. }


    Now when I call this method it generates an IndexOutOfBounds exception at the assignment of castleWorld.
    Any idea?
     
  4. Offline

    SacredWaste

    Gopaintman Try removing
    Code:java
    1. .type(WorldType.FLAT).environment(World.Environment.NORMAL)

    from that. Also, Multiverse is a third-party plugin, just noting you said you don't wish to rely on any.
     
  5. Offline

    Gopaintman

    I added that in just for servers that use multiverse, can use multiverse commands on it.



    Plugin still throws the same error.

    ChunkGenerator Class just in case.
    Code:java
    1.  
    2. public class EmptyLandGenerator extends ChunkGenerator
    3. {
    4. public byte[] generate(World world, Random random, int cx, int cz)
    5. {
    6. byte[] result = new byte[32768];
    7.  
    8. return result;
    9. }
    10. }
    11.  
    12.  


    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 6, 2016
  6. Offline

    _Filip

    Why the heck do you format your whitespace like that? It so hard to read. Anyway, you should google more info about block populators. It should help.
     
  7. Offline

    Gopaintman

    Lol, was just how it looked after I removed some comments. Sorry.
     
  8. Offline

    RawCode

    try downloading sample embedded into tutorial (bukkit moon) and do same way.
     
Thread Status:
Not open for further replies.

Share This Page