rutgerkok / WorldGeneratorApi

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

How to remove bedrock (or prevent a chunk generation)? #12

Closed MichaelHilus closed 4 years ago

MichaelHilus commented 4 years ago

I would like to have my world end after 1000 blocks from center (x = 0 and z = 0).

Using a BaseTerrainGenerator, I could already make the chunks generate vanilla like within the circular world border and contain (nearly!) only air when they are outside the border.

But actually, all my chunks outside the border still have the bottom bedrock layers. I thought that with

chunk.getBlocksForChunk().setRegion(0, 0, 0, CHUNK_SIZE, 255, CHUNK_SIZE, Material.AIR);

I could have totally empty chunks, but I must have missed someting. Is there a possibility to remove or override the bedrock layers? Or even to not have these chunks outside the border be generated?

rutgerkok commented 4 years ago

Bedrock is generated after the initial stone has been generated. Unlike most other things, it can generate in air. To disable bedrock, use:

worldGenerator.getWorldDecorator().withoutDefaultBaseDecorations(BaseDecorationType.BEDROCK);

You then need to generate bedrock yourself:

worldGenerator.getWorldDecorator().withCustomBaseDecoration(BaseDecorationType.BEDROCK, myBedrockGenerator);

Here's how vanilla does it.

MichaelHilus commented 4 years ago

Thanks a lot, that works perfectly.