120 lines
7.3 KiB
Markdown
120 lines
7.3 KiB
Markdown
# Biomes
|
|
|
|
A biome says what the ground looks like where it's picked: the blocks on top, the colors grass, leaves and water are
|
|
tinted, and whether it has a season of its own. What grows on it is up to features, see [Features](index.md#features).
|
|
Biomes are data, one file each in a mod's `worldgen/biomes/` folder. The base game's are in
|
|
`mods/bworld/worldgen/biomes/`.
|
|
|
|
Which biome a place gets is up to the generator's biome rules, from the column's climate, the ground's height and how
|
|
far under it the place is. A mod's biome generates where a rule it adds puts it, see
|
|
[Adding Biomes](terrain.md#adding-biomes).
|
|
|
|
Biomes are one per block across and one every 4 blocks up, a cell from `y` to `y + 3` where `y` is a multiple of 4 above
|
|
the world's bottom. The base game's are the same all the way up a column, and a mod can add biomes under the ground, see
|
|
[Underground Biomes](terrain.md#underground-biomes). The ground's surface blocks are always its own cell's biome's, and
|
|
so is the filler under them.
|
|
|
|
## A Biome
|
|
|
|
`worldgen/biomes/dark_forest.json`:
|
|
|
|
```json
|
|
{
|
|
"format_version": 1,
|
|
"biome": {
|
|
"id": "bworld:dark_forest",
|
|
"surface": {
|
|
"top": "bworld:grass_block",
|
|
"filler": "bworld:dirt",
|
|
"filler_depth": 3,
|
|
"bare_cliffs": true
|
|
},
|
|
"colors": {
|
|
"grass": "#507a32",
|
|
"foliage": "#59ae30",
|
|
"water": "#3f76e4"
|
|
}
|
|
}
|
|
}
|
|
```
|
|
|
|
| Field | What it does | When not set |
|
|
| --------------------------- | -------------------------------------------------------------------------- | ------------ |
|
|
| `id` | in your mod's namespace | required |
|
|
| `season` | `spring`, `summer`, `autumn` or `winter`, always, see [Seasons](#seasons) | the calendar |
|
|
| `surface.top` | the block on top of the ground | required |
|
|
| `surface.filler` | the blocks under it | required |
|
|
| `surface.filler_depth` | how many blocks of filler, 0 to 32. Stone is below | required |
|
|
| `surface.underwater_top` | the top block where the ground is under water | `filler` |
|
|
| `surface.underwater_filler` | the filler under water | `filler` |
|
|
| `surface.bare_cliffs` | steep ground shows stone instead of `top` | `false` |
|
|
| `colors.grass` | what blocks with `"tint": { "color": "grass" }` are drawn in, as `#rrggbb` | plains' |
|
|
| `colors.foliage` | the same for `"foliage"`, like leaves | plains' |
|
|
| `colors.water` | the same for `"water"` | plains' |
|
|
|
|
The base game's trees are a feature of its own, not part of biomes: `BIOME_TREES` in `mods/bworld/scripts/trees.ts` says
|
|
which kinds grow in each of its biomes, how often, and in which wood.
|
|
|
|
Above the snow line, around y 176, the top block is snow whatever the biome says.
|
|
|
|
## Biome Ids
|
|
|
|
Biome ids are what `biome_at` gives and what spawns list. The base game has `bworld:deep_ocean`,
|
|
`bworld:deep_frozen_ocean`, `bworld:deep_lukewarm_ocean`, `bworld:ocean`, `bworld:frozen_ocean`, `bworld:warm_ocean`,
|
|
`bworld:river`, `bworld:frozen_river`, `bworld:beach`, `bworld:snowy_beach`, `bworld:stony_shore`, `bworld:plains`,
|
|
`bworld:meadow`, `bworld:forest`, `bworld:dark_forest`, `bworld:swamp`, `bworld:taiga`, `bworld:snowy_plains`,
|
|
`bworld:snowy_taiga`, `bworld:savanna`, `bworld:jungle`, `bworld:desert`, `bworld:snowy_slopes`, `bworld:stony_peaks`,
|
|
`bworld:jagged_peaks` and `bworld:frozen_peaks`.
|
|
|
|
`/locatebiome <id>` finds the nearest one, and how high it is: the ground's y, or under it for a biome under the ground.
|
|
|
|
## Biome Tags
|
|
|
|
Biomes have [tags](../resources/tags.md) too, in `tags/biomes/`. Every base game biome is in one of these four:
|
|
|
|
| Tag | Biomes |
|
|
| --------------------- | -------------------------------------------------------------------------------------------------------------------------------------- |
|
|
| `#bworld:is_ocean` | `ocean`, `deep_ocean`, `frozen_ocean`, `deep_frozen_ocean`, `warm_ocean`, `deep_lukewarm_ocean`, `beach`, `snowy_beach`, `stony_shore` |
|
|
| `#bworld:is_river` | `river`, `frozen_river` |
|
|
| `#bworld:is_mountain` | `meadow`, `frozen_peaks`, `jagged_peaks`, `stony_peaks`, `snowy_slopes` |
|
|
| `#bworld:is_forest` | `forest`, `dark_forest`, `savanna`, `plains`, `snowy_plains`, `taiga`, `snowy_taiga`, `jungle`, `swamp`, `desert` |
|
|
|
|
A mod's biome joins one by adding itself to the tag's file, like `tags/biomes/bworld/is_forest.json`, and a script
|
|
checks a biome with `ctx.tags.has("biomes", "bworld:is_forest", ctx.world.biome_at(x, y, z))`.
|
|
|
|
Biomes under the ground go in the common tags NeoForge mods check, `#c:is_underground`, and `#c:is_cave` for caves.
|
|
|
|
## Seasons
|
|
|
|
Seasons follow the calendar, 49 days each: days 1 to 49 are spring, 50 to 98 summer, 99 to 147 autumn and 148 to 196
|
|
winter, then it's spring again. Seasons change at 06:00, when `ctx.world.day` and the clock's day go up, so the first
|
|
spring is `ctx.world.day` 0 to 48. A biome that sets `season` is always in it instead, like winter in `snowy_plains` and
|
|
summer in `desert`.
|
|
|
|
Scripts read the season where something is:
|
|
|
|
| Where | Biome | Season |
|
|
| ---------------------------------------------- | ----------------------------- | ------------------------------ |
|
|
| a block in a server component, like `on_tick` | `block.biome` | `block.season` |
|
|
| an entity from `ctx.world.spawn_entity` | `entity.biome` | `entity.season` |
|
|
| a player, on the server | `player.biome` | `player.season` |
|
|
| any block, in server, shared and client phases | `ctx.world.biome_at(x, y, z)` | `ctx.world.season_at(x, y, z)` |
|
|
| the player on this client | `ctx.player.biome` | `ctx.player.season` |
|
|
| a feature's chunk, see [Features](index.md) | `chunk.biome_at(x, y, z)` | |
|
|
|
|
`biome_at` is NeoForge's `level.getBiome(pos)`. Entities and players go by the block their feet are in, like
|
|
`level.getBiome(entity.blockPosition())`. Above and below the world it's the biome at its top or bottom. On the server
|
|
every block has a biome: in a chunk that isn't loaded it's what generation makes there, which takes a while the first
|
|
time. In shared rules and client phases it's what that client has loaded, and `undefined` where it has nothing.
|
|
|
|
```ts
|
|
ctx.components.register_block("my_mod:crop", {
|
|
on_new_day(block) {
|
|
if (block.season === "winter") return; // doesn't grow in winter
|
|
// ...
|
|
},
|
|
});
|
|
```
|
|
|
|
`Season` is exported from `cubi/server`, `cubi/client` and `cubi/shared`.
|