Solved Custom World Generation

Developmur

New member
Jan 27, 2022
2
0
1
Hi all,

I'm working on a custom world generation plugin but i cant find any information on how to do so.
I've found this old bukkit wiki page https://bukkit.fandom.com/wiki/Developing_a_World_Generator_Plugin But when i tried to follow this i ran into deprecated methods and i saw that world gen was splitted in multiple stages. Is there any documentation or examples on how this works? Any help would be appreciated.

Right now i have this and it generates something, But i get the feeling i'm butchering the entire system that is in place...


Java:
public class CustomChunkGenerator extends ChunkGenerator {

    int curHeight = 0;

    @Override
    public void generateSurface(@NotNull WorldInfo worldInfo, @NotNull Random random, int x, int z, @NotNull ChunkData chunkData) {
        SimplexOctaveGenerator generator = new SimplexOctaveGenerator(new Random(worldInfo.getSeed()), 8);
        generator.setScale(0.01D);
        for (int posX = 0; posX < 16; posX++) {
            for (int posZ = 0; posZ < 16; posZ++) {
                curHeight = (int) (generator.noise(x*16+posX, z*16+posZ, 0.5D, 0.5D)*15D+50D);
                chunkData.setBlock(posX, curHeight, posZ, Material.GRASS_BLOCK);
                chunkData.setBlock(posX, curHeight-1, posZ, Material.DIRT);
                for (int i = curHeight-2; i > 0; i--)
                    chunkData.setBlock(posX, i, posZ, Material.STONE);
                chunkData.setBlock(posX, 0, posZ, Material.BEDROCK);
            }
        }
    }
}
 
Last edited: