1.15.2 Empty ChunkGenerator + Prevent Dragon Spawning

Discussion in 'Spigot Plugin Development' started by FullPotato, Feb 7, 2020.

  1. I've been trying to make a completely empty End world. I've been developing this plugin in 1.15.1 and everything went well.

    But when I ported it to 1.15.2, my empty world(s), when they first generate and the first time I join it, I would crash the server. It eventually kicks me for flying since I'm floating in mid-air, and when I try to rejoin, it just gives me "internal server error". After I restart the server, every subsequent time I enter / exit the world is fine.

    I think I narrowed the issue down to the ChunkGenerators that I've been using because when I remove the generator, it no longer crashes.

    Here's the code for actually making the world: https://hastebin.com/opifedowig.java
    Here's the code for the ChunkGenerator that's supposed to make an empty world: https://hastebin.com/yiwunawiva.java
    And, here's the error / stacktrace that I get when I first join the world (I'm using Multiverse to teleport to it in this case): https://hastebin.com/lemuzozuzu.md


    [Note] And while I'm at it, since I'm trying to create an empty End world, is there a way to prevent the Dragon from spawning? Right now I'm just sending it to the void and killing it, and then removing the portal afterwards, but that's a "quick and dirty" fix. Is there a better way?
     
  2. The error since to be coming from multiverse core. Report to the author if it has already been ported to 1.15.2. Otherwise wait for the new update. Basically it's trying to teleport you in a safe spot but there's no block so the plugin doesn't know what to do. Maybe there's a config to disable this. Check into their config file.
     
  3. Use this (Just did it TESTED works)

    Code (Text):

    final WorldCreator worldCreator = new WorldCreator("name");
    worldCreator.environment(World.Environment.THE_END);

    worldCreator.generator(new EmptyEndGenerator());

    final World empty_end = getServer().createWorld(worldCreator)

    public class EmptyEndGenerator extends ChunkGenerator {

        int height = 50;

        @Override
        public ChunkData generateChunkData(World world, Random random, int chunkX, int chunkZ, ChunkGenerator.BiomeGrid biome) {
            ChunkData chunk = createChunkData(world);

            for (int X = 0; X < 16; X++) {
                for (int Z = 0; Z < 16; Z++) {
                    for (int i = height; i > 0; i--) {
                        chunk.setBlock(X, i, Z, Material.ENDER_STONE);
                    }
                }
            }

            return chunk;
        }
    }
     
     
    • Like Like x 1
    • Winner Winner x 1
  4. Listen for the entity spawn event and cancel it if it's in that world and if it's an ender dragon
     
    • Like Like x 1
  5. Thanks! I looked over this code and compared it with mine; it seems that my .generateStructures(false); was causing it for some reason. In any case, it's fixed now.

    I've already tried that, it was one of the first things I've tried, actually. It seems that the world will keep trying to spawn the dragon back in constantly unless it actually dies, for some reason.