Solved WorldCreator not working in 1.14?

Discussion in 'Spigot Plugin Development' started by minecraftguy719, Feb 16, 2020.

  1. Hello all, I am trying to create a world using WorldCreator however when it tries to generator the world the server prints 'Preparing spawn area: 0%' and stops responding.

    Code (Text):

           // Check if the map exists.
            if (Bukkit.getWorld("void") == null) {
                // Broadcast that the world is being created.
                Bukkit.broadcastMessage("Creating void world! Please stand by.");
                // Create a WorldCreator object.
                WorldCreator wc = new WorldCreator("void");
                // Set the type to NORMAL.
                wc.type(WorldType.NORMAL);
                // Set the generator to be VoidWorld.
                wc.generator(new VoidWorld());
                // Create the world.
                wc.createWorld();
                // Broadcast that the world has been created.
                Bukkit.broadcastMessage("Void world created!");
            }
     
     
  2. Try if it works in other versions like 1.13 and 1.15
     
  3. Sorry for not mentioning earlier but it works no problems in 1.8.8.
     
  4. Whats the voidworld class code?
     
  5. Code (Text):

    public byte[] generate(World world, Random rand, int chunkx, int chunkz) {
        return new byte[32768];
    }
     
     
  6. No sorry haha
    Code (Text):

    public byte[] generate(World world, Random rand, int chunkx, int chunkz) {
            return new byte[32768];
        }

        public Location getFixedSpawnLocation(World world, Random random) {
            return new Location(world, 0, 128, 0);
        }
       
        public List<BlockPopulator> getDefaultPopulators(World world) {
            return Arrays.asList(new BlockPopulator[0]);
        }

        public boolean canSpawn(World world, int x, int z) {
            return true;
        }
     
     
  7. Is the class extending ChunkGenerator? cause in 1.14 it's not these methods for chunk generation
     
  8. konsolas

    Supporter

    The ChunkGenerator API has changed - you now return a ChunkData instead of a byte array.
     
  9. The class is indeed extending ChunkGenerator.
    How would I go about doing this?
     
  10. konsolas

    Supporter

    Make sure you're building against the current version of the bukkit API (if you are, then the code you've posted shouldn't compile).

    Override generateChunkData() and just return createChunkData().
     
  11. I've tried this:
    Code (Text):

    @Override
        public List<BlockPopulator> getDefaultPopulators(World world) {
            return Arrays.asList(new BlockPopulator[0]);
        }

        @Override
        public boolean canSpawn(World world, int x, int z) {
            return true;
        }

        @Override
        public ChunkData generateChunkData(World world, Random random, int x, int z, BiomeGrid biome) {
            return super.generateChunkData(world, random, x, z, biome);
        }

        @Override
        public Location getFixedSpawnLocation(World world, Random random) {
            return new Location(world, 0, 128, 0);
        }
     
    With the same result.
     
  12. konsolas

    Supporter

    That's because you've ignored me and you're returning super.generateChunkData instead of createChunkData.
     
  13. Oh sorry my bad, I changed it and it works now. Thank you so much!
     
    • Like Like x 1