rutgerkok / WorldGeneratorApi

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

Possibility to replace biome? #10

Closed MichaelHilus closed 4 years ago

MichaelHilus commented 4 years ago

First off, thanks for this great project!

I'm creating my own BiomeGenerator and wonder if it would somehow be possible to just replace some biomes that minecraft would vanillany set.

Example: I want a world where everything is vanilla like, except all DESERT is replaced by PLAINS.

As getZoomedOutBiome only gets x, y and z coordinates, I assume this is not possible, as I cannot find out the "original" biome at this coordinate? Or is there any other way?

rutgerkok commented 4 years ago

It's possible. The trick is to save the original (vanilla) biome generator before you replace it.

            BiomeGenerator vanillaBiomeGenerator = worldGenerator.getBiomeGenerator();
            worldGenerator.setBiomeGenerator(new BiomeGenerator() {

                @Override
                public Biome getZoomedOutBiome(int x, int y, int z) {
                    Biome biome = vanillaBiomeGenerator.getZoomedOutBiome(x, y, z);
                    if (biome == Biome.DESERT) {
                        return Biome.PLAINS;
                    }
                    return biome;
                }
            });

I don't know exactly what you want, but likely you'll also need to replace biomes suchs as DESERT_HILLS.