rutgerkok / WorldGeneratorApi

Minecraft Spigot plugin that enables other plugins to customize world generation
MIT License
95 stars 9 forks source link

Strongholds not generating #24

Closed sepiatonal closed 3 years ago

sepiatonal commented 3 years ago

Example code:

public class DrainTheSwamp extends JavaPlugin implements Listener {

    @Override
    public void onEnable() {
        getServer().getPluginManager().registerEvents(this,this);
    }

    @EventHandler
    public void onWorldGeneratorInit(WorldGeneratorInitEvent event) {
        BiomeGenerator def = event.getWorldGenerator().getBiomeGenerator();
        event.getWorldGenerator().setBiomeGenerator(
            new BiomeGenerator() {
                @Override
                public Biome getZoomedOutBiome(int x, int y, int z) {
                    Biome biome = def.getZoomedOutBiome(x, y, z);
                    if (biome == Biome.SWAMP) {
                        return Biome.BIRCH_FOREST;
                    }
                    if (biome == Biome.SWAMP_HILLS) {
                        return Biome.BIRCH_FOREST_HILLS;
                    }
                    return biome;
                }
            }
        );
    }
}

I'm getting this issue on version 1.1.1, but I assume it's also a problem in 1.1.2, as I see no reason it would have changed. This code is resulting in either strongholds not generating, or in some world file issue that causes eyes of ender to be unaware of strongholds (unsure which it is).

Steps to reproduce: Create a simple WorldGeneratorAPI plugin that replaces the biome generator (I'm unsure if even this is actually necessary, or if this is the case with all WorldGeneratorAPI plugins right now), and throw an Eye of Ender in the world.

Unsure specifically what's causing this, but I assume it's related to strongholds getting their own DecorationType in the 1.16 update.

rutgerkok commented 3 years ago

You need to add this to your BiomeGenerator:

        @Override
        public ImmutableSet<Biome> getStructureBiomes() {
            return def.getStructureBiomes();
        }

I'll update the documentation to add this.