Skip to content

Instantly share code, notes, and snippets.

@XI64
Last active December 14, 2023 10:45
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save XI64/0480256ed2836e4d301210899551c659 to your computer and use it in GitHub Desktop.
Save XI64/0480256ed2836e4d301210899551c659 to your computer and use it in GitHub Desktop.
Minecraft World Generation Overview by Telepathic Grunt

//World Generation gist written by Telepathic Grunt.

So when minecraft goes to make a chunk, it has a certain order to making the world.

  • Biome Provider
  • ChunkGenerator
  • SurfaceBuilder
  • Carvers
  • Structures/Features Generation Stages

The first stage is the biome layer. The Biome Provider will use math and biome layers to create the layout of biomes in the world. It is not tied to any terrain. Instead, these biomes is what is going to be used to influence the terrain.

The second stage is the Chunk Generator which takes the biomes over an area and creates the general shape of the terrain in chunks using only Stone for solid areas and Water for spaces below sealevel. (Nether uses Netherrack instead and End uses End Stone)

The third stage is the SurfaceBuilder and is ran for each biome in every x/z position. The SurfaceBuilder loops from the highest land height to the bottom of the world for that x/z column and it typically replaces the first few blocks with the biome's specific blocks such as Grass Block/Dirt or Red Sand/Red Sandstone.

Then we now run Carvers for every chunk that is finished with the SurfaceBuilders. The Carver will remove the solid blocks to create caves, ravines, underwater caves, or lava pits (Nether). Mass removal of blocks should always be a Carver to prevent weird interactions with features. Carvers only have their one chunk to carve and cannot look into or touch surrounding chunks when carving in one chunk.

Now we reached the last stage. When all chunks in an area are carved, features and structures can begin generation. Features have a 3x3 chunk area they can safely be placed in but should typically stick in their chunk that is generating them. Structures as like a special kind of feature but only generates in certain coordinates, is divided up, and each piece generates separately safely in the chunk that is currently being made so they don't break the 3x3 range all at once. Structure have a hard limit of 17x17 chunk area.

Though the feature/structure stage can be divided further due to Generation Stages which spawns the feature/structure for that stage before moving on. However, chunks in a given area will generate from no features to all generation stage features so it is not staggered. Meaning, the reason why vanilla Lakes have floating plants is because vanilla Lakes can be placed at a chunk edge and go into a chunk with all it's features placed already and then remove the blocks below the plants. This is why sticking within your generating chunk is best but generation stages help make sure your features generates before another for that specific chunk. Once you cross chunk boundaries, expect weird results.

The Generation Stages are the following:

  • RAW_GENERATION
  • LAKES
  • LOCAL_MODIFICATIONS
  • UNDERGROUND_STRUCTURES
  • SURFACE_STRUCTURES
  • STRONGHOLDS
  • UNDERGROUND_ORES
  • UNDERGROUND_DECORATION
  • VEGETAL_DECORATION
  • TOP_LAYER_MODIFICATION
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment