# stardust-labs-mc/terralith architecture

> Architecture diagram of the GitHub repository stardust-labs-mc/terralith, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-08-18). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/stardust-labs-mc/terralith
- Repository: https://github.com/stardust-labs-mc/terralith

## Overview

#### Purpose and Runtime
This is a Minecraft Java Edition data pack for Terralith-style Overworld world generation. It is declarative: JSON registries and NBT structure templates are loaded by Minecraft’s data-pack runtime, not application code. The pack root is `pack.mcmeta`; the primary loaded namespace is `data/terralith/`, alongside overrides/extensions in `data/minecraft/`, `data/c/`, and `data/forge/`.

#### Entry Points and Versioning
Minecraft loads registries from the data-pack layout, with the Overworld definition as a central entry point: `data/minecraft/dimension/overworld.json`. Runtime initialization also registers Terralith functions through `data/minecraft/tags/functions/load.json`, leading to functions such as `data/terralith/functions/setup.mcfunction`.

Version-specific overlay roots provide targeted registry replacements/additions for Minecraft 1.20.2, 1.20.3, and 1.20.5: `1-20-2-overlay/`, `1-20-3-overlay/`, and `1-20-5-overlay/`. They must remain compatible with the base registry identifiers they replace.

#### Terrain-Shaping Pipeline
Base terrain is controlled by Minecraft noise settings and density functions, overridden or augmented in two namespaces:
- Vanilla Overworld routing: `data/minecraft/worldgen/noise_settings/overworld.json`, `data/minecraft/worldgen/density_function/overworld/noise_router/final_density.json`.
- Terralith terrain forms: `data/terralith/worldgen/density_function/overworld/extra_terrain_sum.json`, `data/terralith/worldgen/density_function/overworld/cliff/spline.json`, and `data/terralith/worldgen/density_function/overworld/special/crater_explosion.json`.

The effective flow is noise/density sampling → terrain volume and aquifer decisions → surface/biome-specific decoration. Density-function references are a critical identifier boundary: renaming files changes registry IDs and breaks consumers.

#### Biomes, Classification, and Features
Biome definitions select climate, effects, generation settings, carvers, and placed features. Core biome catalogues reside in `data/terralith/worldgen/biome/`, for example `data/terralith/worldgen/biome/skylands.json` and `data/terralith/worldgen/biome/cave/frostfire_caves.json`; selected vanilla biome definitions are overridden under `data/minecraft/worldgen/biome/`.

Decoration is split into:
1. **Configured features** describing what generates, e.g. `data/terralith/worldgen/configured_feature/skylands/island.json`.
2. **Placed features** defining placement/modifiers, e.g. `data/terralith/worldgen/placed_feature/skylands/floating_islands.json`.

Biome JSONs consume placed-feature IDs, which in turn consume configured-feature IDs. This is the dominant dependency graph.

#### Carvers, Noise, and Surface Detail
Carvers alter terrain before/alongside decoration: `data/terralith/worldgen/configured_carver/deep_ravine.json` and `data/minecraft/worldgen/configured_carver/canyon.json`. Custom noise parameter registries support biome and cave surface patterns, such as `data/terralith/worldgen/noise/cave/thermal/magma.json` and `data/terralith/worldgen/noise/highlands/creek.json`.

Block and biome tags provide reusable compatibility/classification boundaries for features and external mod ecosystems: `data/terralith/tags/blocks/volcano_blocks.json`, `data/c/tags/worldgen/biome/mountain.json`, and `data/forge/tags/worldgen/biome/is_mountain.json`.

#### Structures and Loot Integration
Structures are composed through structure definitions, placement sets, template pools, processor lists, and NBT templates:
- Registration/placement: `data/terralith/worldgen/structure/fortified_village.json`, `data/terralith/worldgen/structure_set/rare_village.json`.
- Jigsaw composition: `data/terralith/worldgen/template_pool/village/fortified/starts.json`, `data/terralith/worldgen/processor_list/village/fortified/road.json`.
- Physical templates: `data/terralith/structures/village/fortified/start_castle.nbt`.

Structure biome eligibility is mediated by tags such as `data/terralith/tags/worldgen/biome/has_structure/fortified_village.json`. Generated containers resolve Terralith loot tables, for example `data/terralith/loot_tables/village/fortified/treasure.json`. No network services or deployment infrastructure are present; Minecraft’s data-pack loader is the only material runtime dependency.

Main entry points: [`data/terralith/worldgen/biome/skylands.json`](https://github.com/stardust-labs-mc/terralith/blob/1.20/data/terralith/worldgen/biome/skylands.json) (Terralith biome catalog), [`data/minecraft/worldgen/noise_settings/overworld.json`](https://github.com/stardust-labs-mc/terralith/blob/1.20/data/minecraft/worldgen/noise_settings/overworld.json) (Overworld noise settings), [`data/terralith/worldgen/structure/fortified_village.json`](https://github.com/stardust-labs-mc/terralith/blob/1.20/data/terralith/worldgen/structure/fortified_village.json) (Fortified village structure), [`data/terralith/worldgen/template_pool/village/fortified/starts.json`](https://github.com/stardust-labs-mc/terralith/blob/1.20/data/terralith/worldgen/template_pool/village/fortified/starts.json) (Fortified village pool)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Data-pack Runtime"]
  node_loader{{"Minecraft data-pack loader<br/>runtime<br/>[pack.mcmeta]"}}
  node_overworld["Overworld definition<br/>dimension registry<br/>[overworld.json]"]
  node_load_tag["Load function tag<br/>[load.json]"]
  node_setup_function["Setup function<br/>mcfunction<br/>[setup.mcfunction]"]
end

subgraph group_terrain["Terrain Generation"]
  node_noise_settings["Overworld noise settings<br/>[overworld.json]"]
  node_vanilla_router["Vanilla final density router<br/>density function<br/>[final_density.json]"]
  node_terralith_density["Terralith terrain density<br/>density functions"]
  node_carvers["Configured carvers<br/>carver registries<br/>[deep_ravine.json]"]
  node_noise_parameters["Custom noise parameters<br/>noise registries<br/>[magma.json]"]
end

subgraph group_biomes["Biomes &amp; Decoration"]
  node_biome_catalog["Terralith biome catalog<br/>biome registries<br/>[skylands.json]"]
  node_vanilla_biomes["Vanilla biome overrides<br/>biome registries"]
  node_configured_features["Configured features<br/>feature definitions<br/>[island.json]"]
  node_placed_features["Placed features<br/>feature placement"]
  node_compatibility_tags["Block &amp; biome tags<br/>tag registries"]
end

subgraph group_structures["Structures &amp; Loot"]
  node_structure_definition["Fortified village structure<br/>structure registry"]
  node_structure_set["Rare village placement<br/>structure set<br/>[rare_village.json]"]
  node_structure_biome_tag["Structure biome eligibility<br/>biome tag"]
  node_template_pool["Fortified village pool<br/>template pool<br/>[starts.json]"]
  node_processor_list["Village road processors<br/>processor list<br/>[road.json]"]
  node_nbt_templates["Village NBT templates<br/>structure templates<br/>[start_castle.nbt]"]
  node_loot_tables["Fortified village loot<br/>loot tables<br/>[treasure.json]"]
end

subgraph group_versions["Version Overlays"]
  node_overlays["Version overlays<br/>overlay roots"]
end

node_loader -->|"loads dimension"| node_overworld
node_loader -->|"runs load tag"| node_load_tag
node_load_tag -->|"registers function"| node_setup_function
node_overlays -.->|"replaces or extends IDs"| node_overworld
node_overlays -.->|"replaces or extends IDs"| node_noise_settings
node_overworld -->|"uses"| node_noise_settings
node_noise_settings -->|"routes density sampling"| node_vanilla_router
node_vanilla_router -->|"references terrain forms"| node_terralith_density
node_terralith_density -->|"samples noise"| node_noise_parameters
node_noise_settings -->|"terrain generation includes"| node_carvers
node_biome_catalog -->|"consumes"| node_placed_features
node_vanilla_biomes -->|"consumes"| node_placed_features
node_placed_features -->|"references"| node_configured_features
node_configured_features -->|"uses classifications"| node_compatibility_tags
node_biome_catalog -->|"selects"| node_carvers
node_biome_catalog -->|"uses surface patterns"| node_noise_parameters
node_structure_set -->|"places"| node_structure_definition
node_structure_definition -->|"filters eligible biomes"| node_structure_biome_tag
node_structure_definition -->|"composes from"| node_template_pool
node_template_pool -->|"applies"| node_processor_list
node_template_pool -->|"selects templates"| node_nbt_templates
node_nbt_templates -->|"containers resolve"| node_loot_tables
node_biome_catalog -.->|"provides generation context"| node_structure_set

click node_loader "https://github.com/stardust-labs-mc/terralith/blob/1.20/pack.mcmeta"
click node_overworld "https://github.com/stardust-labs-mc/terralith/blob/1.20/data/minecraft/dimension/overworld.json"
click node_load_tag "https://github.com/stardust-labs-mc/terralith/blob/1.20/data/minecraft/tags/functions/load.json"
click node_setup_function "https://github.com/stardust-labs-mc/terralith/blob/1.20/data/terralith/functions/setup.mcfunction"
click node_noise_settings "https://github.com/stardust-labs-mc/terralith/blob/1.20/data/minecraft/worldgen/noise_settings/overworld.json"
click node_vanilla_router "https://github.com/stardust-labs-mc/terralith/blob/1.20/data/minecraft/worldgen/density_function/overworld/noise_router/final_density.json"
click node_terralith_density "https://github.com/stardust-labs-mc/terralith/blob/1.20/data/terralith/worldgen/density_function/overworld/extra_terrain_sum.json"
click node_carvers "https://github.com/stardust-labs-mc/terralith/blob/1.20/data/terralith/worldgen/configured_carver/deep_ravine.json"
click node_noise_parameters "https://github.com/stardust-labs-mc/terralith/blob/1.20/data/terralith/worldgen/noise/cave/thermal/magma.json"
click node_biome_catalog "https://github.com/stardust-labs-mc/terralith/blob/1.20/data/terralith/worldgen/biome/skylands.json"
click node_configured_features "https://github.com/stardust-labs-mc/terralith/blob/1.20/data/terralith/worldgen/configured_feature/skylands/island.json"
click node_placed_features "https://github.com/stardust-labs-mc/terralith/blob/1.20/data/terralith/worldgen/placed_feature/skylands/floating_islands.json"
click node_compatibility_tags "https://github.com/stardust-labs-mc/terralith/blob/1.20/data/terralith/tags/blocks/volcano_blocks.json"
click node_structure_definition "https://github.com/stardust-labs-mc/terralith/blob/1.20/data/terralith/worldgen/structure/fortified_village.json"
click node_structure_set "https://github.com/stardust-labs-mc/terralith/blob/1.20/data/terralith/worldgen/structure_set/rare_village.json"
click node_structure_biome_tag "https://github.com/stardust-labs-mc/terralith/blob/1.20/data/terralith/tags/worldgen/biome/has_structure/fortified_village.json"
click node_template_pool "https://github.com/stardust-labs-mc/terralith/blob/1.20/data/terralith/worldgen/template_pool/village/fortified/starts.json"
click node_processor_list "https://github.com/stardust-labs-mc/terralith/blob/1.20/data/terralith/worldgen/processor_list/village/fortified/road.json"
click node_nbt_templates "https://github.com/stardust-labs-mc/terralith/blob/1.20/data/terralith/structures/village/fortified/start_castle.nbt"
click node_loot_tables "https://github.com/stardust-labs-mc/terralith/blob/1.20/data/terralith/loot_tables/village/fortified/treasure.json"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_loader,node_overworld,node_load_tag,node_setup_function toneBlue
class node_noise_settings,node_vanilla_router,node_terralith_density,node_carvers,node_noise_parameters toneAmber
class node_biome_catalog,node_vanilla_biomes,node_configured_features,node_placed_features,node_compatibility_tags toneMint
class node_structure_definition,node_structure_set,node_structure_biome_tag,node_template_pool,node_processor_list,node_nbt_templates,node_loot_tables toneRose
class node_overlays toneIndigo
```

## Components

### Data-pack Runtime

Minecraft loads declarative registries and functions.

- [Minecraft data-pack loader](https://github.com/stardust-labs-mc/terralith/blob/1.20/pack.mcmeta): runtime · The sole material runtime dependency. · `pack.mcmeta`
- [Overworld definition](https://github.com/stardust-labs-mc/terralith/blob/1.20/data/minecraft/dimension/overworld.json): dimension registry · Central Overworld world-generation entry point. · `data/minecraft/dimension/overworld.json`
- [Load function tag](https://github.com/stardust-labs-mc/terralith/blob/1.20/data/minecraft/tags/functions/load.json): function tag · `data/minecraft/tags/functions/load.json`
- [Setup function](https://github.com/stardust-labs-mc/terralith/blob/1.20/data/terralith/functions/setup.mcfunction): mcfunction · `data/terralith/functions/setup.mcfunction`

### Terrain Generation

Noise routing, density functions, carvers, and surface inputs.

- [Overworld noise settings](https://github.com/stardust-labs-mc/terralith/blob/1.20/data/minecraft/worldgen/noise_settings/overworld.json): noise settings · `data/minecraft/worldgen/noise_settings/overworld.json`
- [Vanilla final density router](https://github.com/stardust-labs-mc/terralith/blob/1.20/data/minecraft/worldgen/density_function/overworld/noise_router/final_density.json): density function · `data/minecraft/worldgen/density_function/overworld/noise_router/final_density.json`
- [Terralith terrain density](https://github.com/stardust-labs-mc/terralith/blob/1.20/data/terralith/worldgen/density_function/overworld/extra_terrain_sum.json): density functions · Referenced registry IDs must remain stable. · `data/terralith/worldgen/density_function/overworld/extra_terrain_sum.json`
- [Configured carvers](https://github.com/stardust-labs-mc/terralith/blob/1.20/data/terralith/worldgen/configured_carver/deep_ravine.json): carver registries · `data/terralith/worldgen/configured_carver/deep_ravine.json`
- [Custom noise parameters](https://github.com/stardust-labs-mc/terralith/blob/1.20/data/terralith/worldgen/noise/cave/thermal/magma.json): noise registries · `data/terralith/worldgen/noise/cave/thermal/magma.json`

### Biomes & Decoration

Biome generation settings resolve feature registries.

- [Terralith biome catalog](https://github.com/stardust-labs-mc/terralith/blob/1.20/data/terralith/worldgen/biome/skylands.json): biome registries · Defines climate, effects, carvers, and generation settings. · `data/terralith/worldgen/biome/skylands.json`
- **Vanilla biome overrides**: biome registries
- [Configured features](https://github.com/stardust-labs-mc/terralith/blob/1.20/data/terralith/worldgen/configured_feature/skylands/island.json): feature definitions · Defines what generates. · `data/terralith/worldgen/configured_feature/skylands/island.json`
- [Placed features](https://github.com/stardust-labs-mc/terralith/blob/1.20/data/terralith/worldgen/placed_feature/skylands/floating_islands.json): feature placement · Adds placement modifiers to configured features. · `data/terralith/worldgen/placed_feature/skylands/floating_islands.json`
- [Block & biome tags](https://github.com/stardust-labs-mc/terralith/blob/1.20/data/terralith/tags/blocks/volcano_blocks.json): tag registries · Classification boundary for features and mod ecosystems. · `data/terralith/tags/blocks/volcano_blocks.json`

### Structures & Loot

Jigsaw structures resolve templates, processors, tags, and loot.

- [Fortified village structure](https://github.com/stardust-labs-mc/terralith/blob/1.20/data/terralith/worldgen/structure/fortified_village.json): structure registry · `data/terralith/worldgen/structure/fortified_village.json`
- [Rare village placement](https://github.com/stardust-labs-mc/terralith/blob/1.20/data/terralith/worldgen/structure_set/rare_village.json): structure set · `data/terralith/worldgen/structure_set/rare_village.json`
- [Structure biome eligibility](https://github.com/stardust-labs-mc/terralith/blob/1.20/data/terralith/tags/worldgen/biome/has_structure/fortified_village.json): biome tag · `data/terralith/tags/worldgen/biome/has_structure/fortified_village.json`
- [Fortified village pool](https://github.com/stardust-labs-mc/terralith/blob/1.20/data/terralith/worldgen/template_pool/village/fortified/starts.json): template pool · `data/terralith/worldgen/template_pool/village/fortified/starts.json`
- [Village road processors](https://github.com/stardust-labs-mc/terralith/blob/1.20/data/terralith/worldgen/processor_list/village/fortified/road.json): processor list · `data/terralith/worldgen/processor_list/village/fortified/road.json`
- [Village NBT templates](https://github.com/stardust-labs-mc/terralith/blob/1.20/data/terralith/structures/village/fortified/start_castle.nbt): structure templates · `data/terralith/structures/village/fortified/start_castle.nbt`
- [Fortified village loot](https://github.com/stardust-labs-mc/terralith/blob/1.20/data/terralith/loot_tables/village/fortified/treasure.json): loot tables · `data/terralith/loot_tables/village/fortified/treasure.json`

### Version Overlays

Targeted registry replacements for supported Minecraft versions.

- **Version overlays**: overlay roots · Registry-compatible additions and replacements for 1.20.2, 1.20.3, and 1.20.5.

## Connections

- Minecraft data-pack loader → Overworld definition: loads dimension
- Minecraft data-pack loader → Load function tag: runs load tag
- Load function tag → Setup function: registers function
- Version overlays → Overworld definition: replaces or extends IDs
- Version overlays → Overworld noise settings: replaces or extends IDs
- Overworld definition → Overworld noise settings: uses
- Overworld noise settings → Vanilla final density router: routes density sampling
- Vanilla final density router → Terralith terrain density: references terrain forms
- Terralith terrain density → Custom noise parameters: samples noise
- Overworld noise settings → Configured carvers: terrain generation includes
- Terralith biome catalog → Placed features: consumes
- Vanilla biome overrides → Placed features: consumes
- Placed features → Configured features: references
- Configured features → Block & biome tags: uses classifications
- Terralith biome catalog → Configured carvers: selects
- Terralith biome catalog → Custom noise parameters: uses surface patterns
- Rare village placement → Fortified village structure: places
- Fortified village structure → Structure biome eligibility: filters eligible biomes
- Fortified village structure → Fortified village pool: composes from
- Fortified village pool → Village road processors: applies
- Fortified village pool → Village NBT templates: selects templates
- Village NBT templates → Fortified village loot: containers resolve
- Terralith biome catalog → Rare village placement: provides generation context
