Generating an Empty World

Discussion in 'Plugin Development' started by wildgoose2, Aug 2, 2013.

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

    wildgoose2

    I'm wondering how I can create an empty world type in my plugin so when the chunks generate, they are empty :/
     
  2. Offline

    clienthax

    Define empty?, like no chunks attall? or flatland?
     
  3. Offline

    wildgoose2

  4. Offline

    clienthax

    Mhm, you would have to use a custom generator for that i think, let me look into it
     
  5. Offline

    wildgoose2

    I know, but they do not show how to implement into a plugin itself. All they show is what to add to the bukkit.yml
     
  6. Offline

    Polaris29

    Something like this.

    Main class:
    Code:java
    1.  
    2. import org.bukkit.generator.ChunkGenerator;
    3. import org.bukkit.plugin.java.JavaPlugin;
    4.  
    5. public class Main extends JavaPlugin {
    6. @Override
    7. public ChunkGenerator getDefaultWorldGenerator(String worldName, String id) {
    8. return new EmptyGenerator();
    9. }
    10. }
    11.  

    Generator class:
    Code:java
    1.  
    2. import java.util.ArrayList;
    3. import java.util.List;
    4. import java.util.Random;
    5.  
    6. import org.bukkit.World;
    7. import org.bukkit.generator.BlockPopulator;
    8. import org.bukkit.generator.ChunkGenerator;
    9.  
    10. public class EmptyGenerator extends ChunkGenerator {
    11. @Override
    12. public List<BlockPopulator> getDefaultPopulators(World world) {
    13. return new ArrayList<BlockPopulator>(); // Empty list
    14. }
    15.  
    16. @Override
    17. public boolean canSpawn(World world, int x, int z) {
    18. return true;
    19. }
    20.  
    21. @Override
    22. public byte[][] generateBlockSections(World world, Random random, int chunkx, int chunkz, ChunkGenerator.BiomeGrid biomes) {
    23. return new byte[world.getMaxHeight() / 16][];
    24. }
    25. }
    26.  

    Don't know if you know about this, but there's this cool thing called "searching for 'bukkit world generation' or 'bukkit world generation tutorial' on Google"
     
  7. Offline

    wildgoose2

    In fact I did search google OwO But instead of showing me help, It showed me a ton of peoples plugins :O

    My question however, is how can I use this to generate an empty world using that generator? I know how to make a generator, I need to call it in my plugin so instead of Bukkit.createWorld(new WorldCreator(i + "-arena").type(WorldType.Flat)));

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 3, 2016
Thread Status:
Not open for further replies.

Share This Page