Creating a new world

Discussion in 'Plugin Development' started by Flascher, Mar 2, 2012.

  1. Offline

    Flascher

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    So, I have a few questions that I can hopefully get through rather shortly in this thread.

    Basically, what I want to do is create a SkyBlock on my server, except I would rather have each player have their own private SkyBlocks, or have the ability to share the access to their SkyBlock with others.

    For this, would it be best to have one world where each skyblock is spaced out VERY far from each other? (at least 1000 blocks or so) or would it be better to have a separate world for each personal SkyBlock?

    Secondly, (if having separate worlds is the best option, which I'm rather doubtful of) how would I go about creating a new world with code? I suppose I'd need to do this even if it is just one world for SkyBlocks, for simplicity's sake I suppose.

    Thirdly, would it be best to have a custom generator for making a SkyBlock every thousand blocks or so, or a generator that makes nothing but air, and then do like setBlock() (or whatever the method is... I'd also like to know what method is used for that as well, please and thank you. :) ) whenever a person uses the command to set up their own SkyBlock.

    This is going to be my first plugin, so I'm pretty new to all of this, although I've dabbled a tiny bit before. I don't have any more questions at the moment, but if I think of any more I'll be sure to post them in this thread as well. Thanks in advance for all the help!

    ~Flascher
     
  2. Offline

    Flascher

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    bump for help please? (Hope bumping isn't against the rules...)
     
  3. Offline

    ferrybig

    My BukkitDev Profile
    My Plugins (8)
    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    server.createWorld(...)
     
  4. Offline

    Flascher

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    Thank you sir, at least someone's answered one of my questions :)
     
  5. Offline

    gjossep

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    I think that having only one extra world is better as it will decrease server lag. I am not sure on how to do that but i will look it up for you!

    Gjosse
     
  6. Offline

    Flascher

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    That's what I was thinking as well! So how would I go about checking if the SkyBlock world already exists? (also, how do you instantiate server? when I did it said it was abstract and implemented a bunch of "unsupported methods")
     
  7. Offline

    manniL

    My BukkitDev Profile
    My Plugins (9)
    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    Checking if the world exists:
    Code (Text):
    1. if(this.getServer().getWorlds().contains("NAME")){
    2.  
    3. something}else{something else}
     
    Flascher likes this.
  8. Offline

    Flascher

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    Thanks so much manniL! Would you know how to place blocks in a organized manner? Such as like placing a house for example?
     
  9. Offline

    manniL

    My BukkitDev Profile
    My Plugins (9)
    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    Mhm... IDK, I could imagine that this is possible, if you check the blocks which are under/over the location it could be possible. build step by step.
     
  10. Offline

    Flascher

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    what function to you use to place a block though? Is it something like getServer().getPosition().setBlock("Wood"); or whatever?
     
  11. Offline

    manniL

    My BukkitDev Profile
    My Plugins (9)
    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    You could use player.getEyeLocation.getBlock().setTyp(Material.WOOD)
     
  12. Offline

    Flascher

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    hmmm. Well I'm planning on trying to create a SkyBlock island when a user asks to have a SkyBlock. So I guess I'd generate a random position, check to make sure its a good distance from any blocks other than air, and then build outwards from that central spot?
     
  13. Offline

    manniL

    My BukkitDev Profile
    My Plugins (9)
    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
  14. Offline

    Flascher

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    well, we'll see how this goes ;) also, another question. I seem to be full of them. XD

    since its a new world, would it be best to make a custom generator that generates nothing but air? Or is there some way I could just use the default generator for that?

    And, for the getServer().createWorld() there is a required string argument for createWorld() and it has environments or generators... the default is createWorld("null") so what exactly would that do... although I suppose it might be best to just test it myself. ha.
     
  15. Offline

    manniL

    My BukkitDev Profile
    My Plugins (9)
    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    Mhm...

    You can build your own WorldGenerator. I think when you use createWorld(), the server throws an exception or so.
     
  16. Offline

    Flascher

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    so then to link to my generator, just create a class like SkyBlockGen.class and then instantiate it, (such as SkyBlockGen sbGen = new SkyBlockGen(); ) then would I just use createWorld("sbGen"); ?
     
  17. Offline

    manniL

    My BukkitDev Profile
    My Plugins (9)
    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    I think u need WorldGen sbGen = new WorldGen(); and than you can use createWorld("sbGen"), but im not sure.
     
  18. Offline

    Flascher

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    Hey again. Another question!

    Since the new Anvil map format is out, I'm looking at the MoonChunkGenerator source from Dinnerbone's MoonBukkit plugin, and for byte[] result = new byte[32768]; should 32768 be 65536 since the skycap is 256 now?

    Also, is there anything else involving ChunkGenerators that I should know about in order to comply with the new 1.2 generation?
     
  19. Offline

    Njol

    My BukkitDev Profile
    My Plugins (1)
    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    Read this sticky:ChunkGenerators & BlockPopulators FAQ
    Won't work, since getWorld() returns a list of Worlds, not Strings. Use if (Bukkit.getWorld("name") != null) instead.

    You can find out how to create a new world here and here (look at both).
    You'll end up with something like this:
    Code (Text):
    1. Bukkit.createWorld(new WorldCreator("name").generator(new CustomGenerator(), Bukkit.getConsoleSender()));
    where CustomGenerator is your skyblock world generator.

    edit: fixed link to point to start of thread
     
  20. Offline

    Flascher

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    Thank you very much Njol! (I must say your Skript project looks very promising, keep it up!)

    Also, I'm guessing the point you're trying to get across, is that I'm going to have to wait for them to update the ChunkGenerator class?

    And thank you for the correction for detecting if a world has been created!
     
  21. Offline

    Njol

    My BukkitDev Profile
    My Plugins (1)
    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Minecraft account:
    MCUSERNAME
    I guess so because the Javadoc still refers to the 128 blocks limit.

    Also since you pass the ChunkGenerator as an instance, your plugin likely has to reassign the generator to the world on every server restart. You can however automate this as specified in the sticky.
     

Share This Page