Move world generation outside the engine and into mods and data files

This commit is contained in:
2026-10-11 00:33:59 -03:00
parent afe6e03d4c
commit 3d2b235f64
118 changed files with 8250 additions and 1108 deletions
+4
View File
@@ -22,6 +22,10 @@ mods/
loot_tables/**/*.json # loot tables, see resources/loot_tables.md
worldgen/ores.json
worldgen/biomes/*.json # one biome per file, see worldgen/biomes.md
worldgen/noise/**/*.json # the terrain as data, never sent to players. see worldgen/terrain.md
worldgen/density_function/**/*.json
worldgen/noise_settings/**/*.json
worldgen/biome_source/**/*.json
worldgen/spawns.json # monsters that spawn on their own, see entities/index.md
textures/*.png
textures/*.json # animations, see resources/textures.md
+5 -5
View File
@@ -4,10 +4,8 @@ A biome says what the ground looks like where it's picked: the blocks on top, th
tinted, which trees grow, and whether it has a season of its own. Biomes are data, one file each in a mod's
`worldgen/biomes/` folder. The base game's are in `mods/bworld/worldgen/biomes/`.
> [!NOTE]
> Which biome a column gets is still decided by the engine (`pick_biome` in `common/worldgen/overworld.ts`), from the
> column's climate and height. It only picks the base game's biomes, so a biome a mod adds doesn't generate anywhere
> yet. Mods can still list it in their spawns.
Which biome a column gets is up to the generator's biome rules, from the column's climate and height. A mod's biome
generates where a rule it adds puts it, see [Adding Biomes](terrain.md#adding-biomes).
## A Biome
@@ -56,7 +54,9 @@ tinted, which trees grow, and whether it has a season of its own. Biomes are dat
| `trees.wood` | the logs and leaves a kind grows here when it isn't its own, like dark oak for `big_oak` | |
Tree kinds are `oak`, `big_oak`, `birch`, `spruce`, `jungle`, `acacia` and `cherry`. Woods are `oak`, `spruce`, `birch`,
`jungle`, `acacia`, `dark_oak` and `cherry`. Trees only grow on grass, dirt or snow with air above.
`jungle`, `acacia`, `dark_oak` and `cherry`. Trees only grow on grass, dirt or snow with air above. They're the base
game's trees feature (`mods/bworld/scripts/trees.ts`), which reads every biome's `trees`. It checks the kinds and woods
when the server starts, so `check-mods` doesn't.
Above the snow line, around y 176, the top block is snow whatever the biome says.
+124 -15
View File
@@ -19,9 +19,9 @@ and their builds end up half buried.
Each chunk goes through three passes:
1. **Terrain.** The ground, water, caves and trees. This is built into the engine for now, see below.
2. **Ores.** Every mod's `worldgen/ores.json`, in load order.
3. **Features.** Every mod's registered features, in load order.
1. **Terrain.** The ground, water, caves and biomes, from data, see [Terrain](terrain.md).
2. **Ores.** Every mod's `worldgen/ores.json`, in load order, the base game's first.
3. **Features.** Every mod's features, code and data, by step and then load order, see [Order](#order).
The world is 256 blocks tall and the sea is at y 64.
@@ -49,9 +49,30 @@ Every block in the chunk that is `replaces` and between `min_y` and `max_y` beco
sampled at `(x, y, z) × scale`, is above `threshold`. A smaller `scale` makes bigger veins, and a higher `threshold`
makes rarer ones. Each ore's noise is seeded with its id, so ores don't line up with each other.
Each mod's ores are a pass of their own, after the mods loaded before it. So a mod's ore can replace another mod's, like
`"replaces": "bworld:coal_ore"` for a rare vein inside coal. The base game's are in `mods/bworld/worldgen/ores.json`.
## Features
Features are functions that run on every chunk after terrain and ores. The worldgen script registers them:
Features are what's added to every chunk after its terrain and ores: trees, cacti, boulders, springs. A feature is code
or data, whichever is easier for it, and the two can use each other:
- **Data** suits a known kind of thing placed somewhere, like a column of cactus on sand. It's short, `check-mods`
checks it, and it can use types and modifiers a script registers.
- **Code** suits logic that doesn't fit a type, like the base game's trees, which spread themselves over a grid of cells
across chunks (`mods/bworld/scripts/trees.ts`).
### Order
Features run by **step**, Minecraft's decoration steps: `raw_generation`, `lakes`, `local_modifications`,
`underground_structures`, `surface_structures`, `strongholds`, `underground_ores`, `underground_decoration`,
`fluid_springs`, `vegetal_decoration`, `top_layer_modification`. A feature without a step runs in the last one. Within a
step they go by mod load order, and within a mod its data features go first, sorted by id, then its code features in the
order they were registered. The base game's trees are in `vegetal_decoration`, so features in later steps see them.
### Code Features
The worldgen script registers them:
```ts
import type { WorldgenContext } from "bworld/worldgen";
@@ -62,10 +83,12 @@ export function setup(gen: WorldgenContext) {
const x = chunk.x * 16 + Math.floor(chunk.rng.next() * 16);
const z = chunk.z * 16 + Math.floor(chunk.rng.next() * 16);
chunk.set_block(x, chunk.height_at(x, z) + 1, z, "bworld:stone");
});
}, { step: "surface_structures", biomes: ["bworld:plains", "bworld:meadow"] });
}
```
`step` and `biomes` are optional. With `biomes`, the feature only runs in chunks that have one of them.
Feature ids are in the mod's namespace. Each feature's `rng` is seeded with the world's seed, the chunk and the
feature's id, so adding another mod's feature doesn't change what this one generates.
@@ -75,36 +98,122 @@ interface FeatureChunk {
readonly z: number;
readonly seed: string;
readonly rng: { next(): number }; // 0 to 1
random(name: string): { next(): number }; // seeded from the world's seed and name, the same in every chunk
noise_2d(name: string): (x: number, z: number) => number;
noise_3d(name: string): (x: number, y: number, z: number) => number;
height_at(x: number, z: number): number; // surface height, inside this chunk only
biome_at(x: number, z: number): string; // like "bworld:plains", inside this chunk only
get_block(x: number, y: number, z: number): string | undefined; // inside this chunk only
set_block(x: number, y: number, z: number, id: string): void; // up to one chunk away
place_feature(id: string, x: number, y: number, z: number): boolean; // a data feature, see below
}
```
All coordinates are world coordinates. `noise_2d` and `noise_3d` return seeded noise functions, the same for the same
`name` in every chunk, so features can make patterns that continue across chunk borders.
`name` in every chunk, so features can make patterns that continue across chunk borders. `random` does the same for
random numbers: the base game's trees take each cell's from `random("tree_<x>_<z>")`, so every chunk that looks at a
cell agrees on where its tree is.
`set_block` can write up to one chunk away, so a tree near the border can grow into the next chunk. Writes into another
chunk only fill air, so the result doesn't depend on which chunk generates first.
`gen.biomes()` lists every biome mods added, with their `trees`, for features that read biomes' data the way the base
game's trees do.
Generated blocks don't run `on_create`, and worldgen scripts can't use the server or client API.
### Data Features
A file in `worldgen/features/`: Minecraft's configured feature (`type` and `config`, what) and placed feature
(`placement`, where) in one, plus `biomes` and `step`:
```json
{
"format_version": 1,
"feature": {
"id": "copper_tools:cobble_columns",
"type": "minecraft:block_column",
"config": {
"layers": [{
"height": { "type": "uniform", "min_inclusive": 1, "max_inclusive": 3 },
"provider": "bworld:cobblestone"
}]
},
"placement": [
{ "type": "minecraft:count", "count": 4 },
{ "type": "minecraft:in_square" },
{ "type": "minecraft:heightmap", "heightmap": "OCEAN_FLOOR_WG" }
],
"biomes": ["bworld:plains"],
"step": "underground_decoration"
}
}
```
Placement starts at the chunk's corner at the bottom of the world, and each modifier turns the positions so far into new
ones. The feature's type is placed at each position that ends up in one of `biomes`, or at every one without `biomes`.
Built in names work with or without `minecraft:`.
| Type | Config | Places |
| -------------- | ----------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- |
| `simple_block` | `to_place` | One block, where it can stand (its `place_on`). |
| `block_column` | `layers` (`height`, `provider`), `direction`, `allowed_placement`, `prioritize_tip` | Layers stacked `up` (or `down`), cut short where `allowed_placement` doesn't hold (air when not set). |
| Placement modifier | Fields | Does |
| ------------------------ | ----------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `count` | `count` | Each position becomes `count` of them. |
| `rarity_filter` | `chance` | Keeps one in `chance`. |
| `in_square` | | Moves each to a random spot in the chunk, across. |
| `random_offset` | `xz_spread`, `y_spread` | Moves each by those amounts. |
| `height_range` | `height` | Sets the height: an anchor or `constant`/`uniform` of anchors. |
| `heightmap` | `heightmap` | On top of the column: `WORLD_SURFACE_WG`, `WORLD_SURFACE` and `MOTION_BLOCKING` on its highest block, `OCEAN_FLOOR_WG` and `OCEAN_FLOOR` on its highest that isn't a liquid. |
| `block_predicate_filter` | `predicate` | Keeps the positions where a block predicate holds. |
- **Block predicates:** `matching_blocks` (`blocks`: ids and #tags), `solid`, `replaceable`, `would_survive` (`state`),
`not`, `all_of`, `any_of` and `true`. Each takes an `offset`.
- **Numbers** (int providers): a whole number, or `constant`, `uniform` (`min_inclusive`, `max_inclusive`) or
`weighted_list` (`distribution` of `data` and `weight`).
- **Heights:** `{ "absolute": y }`, `{ "above_bottom": n }` or `{ "below_top": n }`.
- **Blocks** (`to_place`, `provider`, `state`): an id, or Minecraft's
`{ "type": "simple_state_provider", "state": { "Name": id } }`.
### Types and Modifiers in Code
A worldgen script can add types and placement modifiers for data features to use, by id:
```ts
gen.register_feature_type<{ block: string; height: number }>("copper_tools:pillar", (chunk, config, origin) => {
for (let i = 0; i < config.height; i++) chunk.set_block(origin.x, origin.y + i, origin.z, config.block);
return true;
});
gen.register_placement_modifier(
"copper_tools:middle",
(chunk, config, positions) => positions.map((p) => ({ x: chunk.x * 16 + 8, y: p.y, z: chunk.z * 16 + 8 })),
);
```
And code can place a data feature with `chunk.place_feature(id, x, y, z)`: its type and config at that spot, without its
placement, with the calling feature's random numbers.
`check-mods` can't run scripts, so it warns about a type or modifier that isn't built in. The server checks them when it
starts, and doesn't start if a data feature uses one no script registered, or if an id is both a code and a data
feature.
## Terrain
The terrain itself is built into the engine (`common/worldgen/`). It works like Minecraft 1.18+, shaped after the
[Tectonic](https://github.com/Apollounknowndev/tectonic) mod: continents, erosion and ridges noises set every column's
height and roughness, and a 3D density is carved into caves. Oceans wind between large continents, with islands out at
sea. Mountain ranges rise where erosion is low, and rivers run along the valleys between ridges, going underground where
they reach mountains. The flatter land is split into regions with their own shapes: valleys and plateaus (with badlands
ridges where it's hot), tiered mesas, rolling hills and jungle pillars, and wetlands and desert dunes.
The terrain is data: noises, density functions, a generator and biome rules, see [Terrain](terrain.md). The base game's
works like Minecraft 1.18+, shaped after the [Tectonic](https://github.com/Apollounknowndev/tectonic) mod: continents,
erosion and ridges noises set every column's height and roughness, and a 3D density is carved into caves. Oceans wind
between large continents, with islands out at sea. Mountain ranges rise where erosion is low, and rivers run along the
valleys between ridges, going underground where they reach mountains. The flatter land is split into regions with their
own shapes: valleys and plateaus (with badlands ridges where it's hot), tiered mesas, rolling hills and jungle pillars,
and wetlands and desert dunes.
Which biome each column gets is part of the terrain, but what a biome looks like is data: see [Biomes](biomes.md).
Which biome each column gets is the generator's biome rules, see [Biome Sources](terrain.md#biome-sources), and what a
biome looks like is its own file, see [Biomes](biomes.md).
`deno run -A tools/worldgen_preview.ts [seed] [out dir] [x z]` renders it to PNG files, around chunk `x z`.
> [!NOTE]
> `register_terrain` exists in the API for mods that replace the terrain generator, but it throws for now: the terrain
> hasn't moved out of the engine yet.
> `register_terrain` exists in the API for mods that replace the terrain with code, but it throws: the terrain is data,
> see [Terrain](terrain.md).
+257
View File
@@ -0,0 +1,257 @@
# Terrain
The shape of the world, which biome each column gets, what its ground is made of and where water goes are all data, in a
mod's `worldgen/` folders. The engine only knows how to evaluate them. The base game's overworld is in
`mods/bworld/worldgen/`, and a mod can add biomes to it with rules of its own.
It works like Minecraft's: noises feed **density functions**, a **noise settings** file puts them together into a
generator, and a **biome source** picks biomes. The names and fields follow Minecraft's where the idea is the same, so
the [Minecraft Wiki](https://minecraft.wiki/w/Density_function) explains most of them. Where bworld differs, it says so
below.
These files are server only: they're left out of the copy of a `.bmod` players download.
```
my_mod/
worldgen/noise/<path>.json # noises
worldgen/density_function/<path>.json # named density functions
worldgen/noise_settings/<path>.json # generators
worldgen/biome_source/<path>.json # biome rules, or rules added to another mod's
```
Ids can have folders, like `bworld:overworld/erosion` in `worldgen/density_function/overworld/erosion.json`.
## How a Chunk Is Made
1. The generator's `terrain` and `caves` density functions are sampled at the corners of cells, `cell_width` blocks
across and each one's `cell_height` up, and blended in between. A block is solid where both are above 0.
2. Each column's biome is the first biome rule that holds, from its climate, the height of its ground and whether it's
steep.
3. Each solid block goes through the `surface_rule`, which gives grass, sand, snow and so on, or `default_block`.
4. Each empty block below the surface of a `fluid` gets it, like water up to sea level.
5. Then [ores](index.md#ores) and [features](index.md#features), like the base game's trees, which grow as the biome's
`trees` say.
## Noises
`worldgen/noise/erosion.json`:
```json
{
"format_version": 1,
"noise": {
"id": "bworld:erosion",
"wavelength": 1280,
"amplitudes": [1, 1, 0, 1, 1],
"quantiles": [-0.917, -0.48, -0.393, "...", 0.917]
}
}
```
| Field | Meaning | Default |
| ------------------ | ----------------------------------------------------------------------------------------------------------------------------------- | ------------- |
| `wavelength` | The size in blocks of the first octave's features. | required |
| `amplitudes` | Each octave's strength. Each octave is twice as fine as the one before. 0 skips one. | required |
| `dimensions` | `2` for x and z, `3` for x, y and z. | `2` |
| `vertical_stretch` | For 3D noises, how much slower it changes up and down than across. | `1` |
| `quantiles` | The noise's percentiles, every 5%, for spreading it evenly from -1 to 1 (see `even` below). Or another noise's id to use its table. | none |
| `seed_name` | What it's seeded with, together with the world's seed. | the id's path |
Unlike Minecraft's, bworld's noises are simplex noise sized by `wavelength` instead of a first octave. Octave noise is
bunched up in the middle of its range. `deno run tools/noise_quantiles.ts '[1,1,0,1,1]'` measures the `quantiles` for a
set of amplitudes, so `"even": true` can spread it out.
## Density Functions
A density function gives a number for every block. A file in `worldgen/density_function/` is one with an `id`:
```json
{
"format_version": 1,
"density_function": {
"id": "bworld:overworld/erosion",
"type": "mul",
"argument1": {
"type": "noise",
"noise": "bworld:erosion",
"even": true,
"x": "bworld:overworld/warp_x",
"z": "bworld:overworld/warp_z"
},
"argument2": 1.05
}
}
```
Wherever a density function goes, a number is a constant and a string is a named density function's id.
| Type | Fields | Gives |
| ---------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `constant` | `argument` | The number. A bare number does the same. |
| `x`, `y`, `z` | | The block's position. bworld's own. |
| `noise` | `noise`, `even`, `x`, `y`, `z` | The noise at the block, or at the position `x`, `y` and `z` give. `even` spreads it by its quantiles. |
| `add`, `sub`, `mul`, `div`, `min`, `max` | `argument1`, `argument2` | The two put together. `sub` and `div` are bworld's own. |
| `abs` | `argument` | Without its sign. |
| `clamp` | `input`, `min`, `max` | `input`, kept from `min` to `max`. |
| `smoothstep` | `input`, `from`, `to` | 0 at `from`, 1 at `to`, a smooth curve in between. bworld's own. |
| `spline` | `spline`: `{ coordinate, points }` | A smooth curve through `points` (`{ location, value, derivative }`) along `coordinate`. A `value` can be another spline, like Minecraft's. `derivative` is 0 when left out. |
| `range_choice` | `input`, bounds, `when_in_range`, `when_out_of_range` | One or the other by whether `input` is within the bounds: `min_inclusive`, `min_exclusive`, `max_inclusive`, `max_exclusive`, any of them. A bound can be a density function. |
| `cache_2d` | `argument` | The same, worked out once per column. Only for functions that don't change with y. |
Named density functions that don't change with y are worked out once per column on their own, so a function used by
several others, like `bworld:overworld/continents`, costs the same as using it once.
Every operation takes two arguments, so how its numbers round is written down. Two generators that do the same sums in
the same order make the same world block for block. The base game's terrain was moved from code into these files that
way, and `tests/worldgen_golden_test.ts` checks it never changes by accident.
## Noise Settings
A generator. The base game's is `worldgen/noise_settings/overworld.json`:
```json
{
"format_version": 1,
"noise_settings": {
"id": "bworld:overworld",
"sea_level": 64,
"default_block": "bworld:stone",
"cell_width": 4,
"terrain": { "density": "bworld:overworld/terrain", "cell_height": 8 },
"caves": { "density": "bworld:overworld/caves", "cell_height": 4 },
"preliminary_surface": "bworld:overworld/height",
"climate": {
"continentalness": "bworld:overworld/continents",
"temperature": "bworld:overworld/temperature",
"humidity": "bworld:overworld/humidity",
"valley": "bworld:overworld/ridges_folded",
"flatness": "bworld:overworld/erosion_folded",
"jaggedness": "bworld:overworld/jaggedness"
},
"steep": 3.5,
"biome_source": "bworld:overworld",
"fluids": [
{ "block": "bworld:water", "below": 64, "where": "open_sky" },
{
"block": "bworld:water",
"below": 64,
"where": { "function": "bworld:overworld/underground_river", "min_exclusive": 0 }
}
],
"surface_rule": { "...": "see below" }
}
}
```
| Field | Meaning |
| --------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `sea_level` | Where the sea's surface is, for surface rules. |
| `default_block` | What solid ground is where the surface rule doesn't say otherwise. |
| `cell_width` | How far apart across `terrain` and `caves` are sampled, 1 to 16. |
| `terrain`, `caves` | Their density function, and how far apart up they're sampled. Solid where both are above 0. |
| `preliminary_surface` | The ground's height before 3D noise. Surface rules, `steep` and `/locatebiome` use it. |
| `climate` | Named values biome rules look at. Any names, except `surface` and `steep`. |
| `steep` | A column is steep when its preliminary surface is this much higher or lower than a neighbor's. |
| `biome_source` | The biome source that picks its biomes. |
| `fluids` | What empty space becomes, the first that applies: below `below`, where there's `open_sky` (nothing but air above) or where a density function is in a range. |
| `surface_rule` | What solid blocks become. |
The world uses `bworld:overworld`. The server doesn't start without it.
## Biome Sources
The rules that pick a column's biome. The first that holds wins, so they go from the most particular to the most
general. The base game's, `worldgen/biome_source/overworld.json`, starts with rivers and oceans under water and ends
with `bworld:dark_forest`, which holds everywhere:
```json
{
"format_version": 1,
"biome_source": {
"id": "bworld:overworld",
"rules": [
{
"id": "bworld:river_bed_frozen",
"when": {
"surface": { "max_exclusive": 63 },
"valley": { "max_exclusive": 0.06 },
"continentalness": { "min_exclusive": -0.2 },
"temperature": { "max_exclusive": -0.65 }
},
"biome": "bworld:frozen_river"
},
{ "id": "bworld:dark_forest", "biome": "bworld:dark_forest" }
]
}
}
```
`when` holds when all its conditions do: a range of one of the generator's `climate` values, a range of `surface` (the y
of the column's top solid block), or `"steep": true` or `false`. Rules without `when` always hold.
This is bworld's own, not Minecraft's multi-noise biome source: a rule can look at how high the ground really is and
whether it's a cliff, which is how beaches, peaks and stony shores are placed.
### Adding Biomes
A mod adds its biomes with a biome source that `extends` another, putting each rule `before` or `after` one of its
rules. Lavender fields on all the land above the beaches that isn't mountains, before the climate picks forests and
plains:
```json
{
"format_version": 1,
"biome_source": {
"id": "lavender:fields",
"extends": "bworld:overworld",
"rules": [{
"id": "lavender:fields",
"before": "bworld:snowy_taiga",
"when": { "surface": { "min_inclusive": 70, "max_inclusive": 120 } },
"biome": "lavender:fields"
}]
}
}
```
Rules from several mods go in in load order. The biome itself is a [biome file](biomes.md) as usual.
## Surface Rules
What a solid block becomes, like Minecraft's surface rules: a rule gives a block or nothing, and the first one in a
`sequence` that gives a block wins. Blocks no rule gives anything for are the `default_block`.
| Rule | Fields | Gives |
| --------------- | ------------------------ | -------------------------------------------------------------------------------------------- |
| `sequence` | `sequence` | The first block its rules give. |
| `condition` | `if_true`, `then_run` | What `then_run` gives, when `if_true` holds. |
| `block` | `result_state: { Name }` | That block. |
| `biome_surface` | `part` | The column's biome's `top`, `filler`, `underwater_top` or `underwater_filler`. bworld's own. |
| Condition | Fields | Holds |
| --------------------------- | ---------- | ----------------------------------------------------------------------------------- |
| `stone_depth` | `offset` | When the solid blocks above it before air are at most `offset`. 0 is the top block. |
| `filler_depth` | | Within the biome's `filler_depth` below the top. bworld's own. |
| `above_preliminary_surface` | `offset` | At or above the preliminary surface plus `offset`. |
| `surface_underwater` | | When the column's ground is below `sea_level` - 1. bworld's own. |
| `steep` | | When the column is steep, see the noise settings' `steep`. |
| `bare_cliffs` | | When the biome's surface has `bare_cliffs`. bworld's own. |
| `y_at_least` | `function` | At or above the height a density function gives, like a snow line. bworld's own. |
| `biome` | `biome_is` | In one of the biomes. |
| `not` | `invert` | When `invert` doesn't. |
The base game's: within 20 blocks of the ground, the top block is the biome's underwater cover under water, snow (or
stone on cliffs) above the snow line, stone on bare cliffs, and the biome's `top` otherwise. Below it, the biome's
filler down to its `filler_depth`. Everything else is stone.
## Changing the Base Game's Terrain
A mod can add biomes to it, but can't replace its files yet: an id defined by two mods is an error. Anything that
changes the terrain changes untouched land in existing worlds, the same as adding a [feature](index.md#features). The
worldgen fingerprint keeps chunks players changed as they were.
[Engine access](../misc/engine.md) mods can hook `engine.common.OverworldTerrain`, whose `density` and `cave` are called
for every cell corner.
`deno run -A tools/worldgen_preview.ts [seed] [out dir] [x z]` renders the base game's generator to PNG files, around
chunk `x z`.
+6 -5
View File
@@ -283,7 +283,8 @@ engine assets in `assets/`.
| Mining: tool speed, `requires_tool`, drops | engine (`client/game_mode.ts`, `server/game/game_server.ts`) | Phase 5 |
| Day and night lengths, sky colors | engine (`common/time.ts`, `client/rendering/game_renderer.ts`) | Phase 5 |
| Where new players spawn | engine (`server/game/world.ts`) | Phase 5 |
| Terrain, biomes, trees and ores | engine (`common/worldgen/`, `common/generation.ts`) | Phase 6 |
| Terrain, biomes and ores | `mods/bworld/worldgen/` (data) | Done |
| Trees | `mods/bworld/scripts/trees.ts` (a code feature) | Done |
### Rules That Keep Existing Worlds Working
@@ -340,10 +341,10 @@ and dropped, containers clicked, players moving between chunks, entities.
rules become something `mods/bworld` sets, with the engine asking it on both sides so clients still predict breaking.
Check: all tests pass unchanged, and old saves still load.
**Phase 6: world generation.** First a golden fixture: a SHA-256 of the final blocks of 64 chunks for 3 seeds, recorded
from the current code. Then port `common/worldgen/` to `mods/bworld/scripts/worldgen.ts` as the `bworld:overworld`
terrain generator (with `register_terrain`), and the ore table to `mods/bworld/worldgen/ores.json`. The server refuses
to start without a terrain generator. Check: the fixture matches exactly.
**Phase 6: world generation.** Moved to data instead of a worldgen script, see [GENERATION.md](../GENERATION.md). The
golden fixture, the ore table, and the terrain, biomes, surface and water as data are done: the server refuses to start
without the `bworld:overworld` generator, and the fixture matches exactly. Trees are a code feature in bworld's worldgen
script.
**Done when** searching `client/`, `common/` and `server/` for `"bworld:` finds only `bworld:air`, removing
`mods/bworld` gives an engine that starts and says it needs a terrain generator, the base game uses no engine access,