Minecraft Wiki
Advertisement
Information icon
This tutorial is exclusive to Java Edition. 

Custom world generation is very complex and difficult for most data pack or mod creators. To create a more complete world, it is necessary to refer to how the world is generated in the vanilla version.

This tutorial roughly explains some of the vanilla world generation files in 1.20.1, making it easy for creators to read and understand the vanilla world generation.

How to obtain vanilla world generation files[]

After 22w42a, most of world generation files can be found in the data/minecraft/worldgen directory in client.jar or server.jar. However, multi-noise biome source parameter list files do not contain details of biome parameter list presets of the vanilla overworld and nether.

Through running the data generator, you can directly generate all vanilla data pack files, as well as biome source parameter list presets of the overworld and the nether.

The vanilla world generation files before 22w42a can be obtained on Slicedlime's github, located at examples repository. Missing versions in the repository commit history mean that the world generation files have not changed in these versions.

Final density function of the overworld[]

Final density function of the overworld is the final_density field in worldgen/noise_settings/overworld.json.

{  //Final density function of the overworld

"type": "minecraft:min",
"argument1":
{  //Brings its value closer to 0, which affects the generation of barriers between different liquid bodies in the aquifer. The smaller the negative value of final_density, the less likely it is to generate barriers
},
"argument2": "minecraft:overworld/caves/noodle"  //Noodle caves

}


In which, the sloped_cheese used to determine the height and shape of the surface terrain is located in data/minecraft/worldgen/density_function/overworld/sloped_cheese.json.

{  //sloped_cheese

"type": "minecraft:add",
"argument1":
{  //Multiplies the factor minecraft:overworld/factor to determine the distribution of 3D terrain. Then multiplies positive values by 4 to avoid deep underground region being affected by base_3d_noise
},
"argument2": "minecraft:overworld/base_3d_noise"  //A 3D noise used to create 3D surface terrain shape

}

In which, the depth to determine the height of general surface terrain is located in data/minecraft/worldgen/density_function/overworld/depth.json.

{  //depth

"type": "minecraft:add",
"argument1":
{  //For each block down, the depth decreases by 1⁄128 (0.0078125), and it is 0 at Y=128
},
"argument2": "minecraft:overworld/offset"  //The terrain height offset using a spline function based on continentalness, erosion, and PV values

}

Surface rules of the overworld[]

Surface rules of the overworld are the surface_rule field in worldgen/noise_settings/overworld.json.

{  //Surface rules of the overworld

"type": "minecraft:sequence",
"sequence": [
//Bedrock layers
{
},
//Surface layers (such as grass blocks and dirt in plains)
{
},
//Deepslate layers
{
}
]

}

Notes[]

Basin[]

Basins (aka. erosions) existed in all biomes before the surface rules were added. When the surface depth is less than or equal to 0, the topmost layer of the terrain is directly removed, leaving a bare stone basin. However, after the surface rules were added, they are somehow limited to only two biomes, frozen ocean and deep frozen ocean, and there is a bug when judging the water surface. In previous basins, blocks above sea level (blocks with Y>=63) were air, otherwise they were ice or water (Note that there were no aquifers or noise caves at that time). In the current vanilla surface rules, it is air when there is no water above it, which can lead to flowing water along the coast.

Carver[]

Due to a mistake in the code about carver, the behavior of the minecraft:water condition during carver generation is inconsistent with that during terrain generation. When generating terrain, the offset value is relative to the air-liquid contact surface (i.e. the block position of the air block). While during carver generation, the offset value is relative to the block position of the top liquid block. And because during carver generation, surface rules are only applied to dirt below when carving grass blocks or mycelium. The game assumes that there is no water above grass blocks and mycelium. Then during carving, grass blocks and mycelium may be carved into water, so there is at most one block of water above the dirt being processed by surface rules. Therefore, the offset value during carver generation can also be said to be relative to the top surface of the processing dirt.

Therefore, when generating terrain, offset values of 0 and -1 have the same effect: only succeed when there is no liquid above. But When carvers generates, if the offset value is -1, the condition is always successful, regardless of whether there is liquid above.

When surface rules were first added into the game (21w41a), the developers were not aware of the mistake in carver code and set the offset value to -1 when checking whether there is water above. As a result, grass blocks can be generated underwater during carver generation. Afterwards (21w43a and 22w07a), in order to resolve this bug, additional redundant minecraft:water conditions with offset values of 0 was added to the blocks that should not be generated underwater. Therefore, the current overworld surface rules in the vanilla game are slightly chaotic, but they can basically work as expected.

For pack and mod creators, it is important to avoid setting offset value to -1 in minecraft:water to ensure that it behaves the same during carver generation and terrain generation.

Biome source parameter list presets[]

Through running the data generator, biome source parameter list presets of the overworld and the nether can be obtained. They are located in generated/reports/biome_parameters/. The biome generation defined therein is explained in detail on the Biome page.

See also[]

Advertisement