More detailed version of Henrik Kniberg’s showcase of the new Ore Generation + Math behind it

A developer of Minecraft, Henrik Kniberg, had posted an image on twitter which showed how Ore Generation works in the new Snapshot 21w07a

I decided to look through the code of Minecraft to get some more details about how the new System functions.

Ores don't only generate with the new System. Redstone, Lapis and Coal generates using the old generation from before 21w07a, as well as the new one.

The way the old generation works is, that there is a Max amount of Veins that can generate in a Chunk. If that limit hasn't been reached yet, a Vein can generate. This Vein gets a Random Y level between it's Min and Max, where it then will Generate.

The way the New Generation works is that the there again is a Max amount of Veins that can generate in a chunk. The Ores also has a Base Y level and a number for Spreading. Whenever a new Vein is going to Generate, this formula will be use to determine it's Y level:

(Random number from 0 to Spread) + (Random number from 0 to Spread) – Spread + Base Y

In this way, the ores will Generate like described on Henrik's image.


leave a comment

Your email address will not be published. Required fields are marked *