Add natural mob spawning for rotwalker
This commit is contained in:
@@ -68,6 +68,8 @@ around and look about. Unlike animals, they go away when no player is near. The
|
||||
}
|
||||
```
|
||||
|
||||
Monsters can also [spawn on their own](#natural-spawning) in the dark.
|
||||
|
||||
**Scripted** entities stay exactly where a script puts them. They don't fall, think or get hurt, and aren't saved with
|
||||
the world, so a script never finds one it doesn't know about after a restart. The fishing hook is one:
|
||||
|
||||
@@ -84,6 +86,51 @@ the world, so a script never finds one it doesn't know about after a restart. Th
|
||||
}
|
||||
```
|
||||
|
||||
## Natural Spawning
|
||||
|
||||
Monsters spawn on their own in the dark around players, the way Minecraft's do. A mod lists which ones, how often and in
|
||||
which biomes in `worldgen/spawns.json`, like NeoForge's `add_spawns` biome modifier. The Undergarden's rotwalkers:
|
||||
|
||||
```json
|
||||
{
|
||||
"format_version": 1,
|
||||
"spawns": [
|
||||
{
|
||||
"entity": "undergarden:rotwalker",
|
||||
"weight": 100,
|
||||
"min_count": 4,
|
||||
"max_count": 4,
|
||||
"chance": 0.1
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
| Field | Default | Meaning |
|
||||
| ----------- | ----------- | --------------------------------------------------------------------------------------------------------------- |
|
||||
| `entity` | required | A `"monster"` entity. Only monsters spawn on their own for now. |
|
||||
| `weight` | required | How often this one is picked over the others that can spawn in the same biome. |
|
||||
| `min_count` | required | How many spawn together, at least. |
|
||||
| `max_count` | required | And at most. |
|
||||
| `biomes` | every biome | Biome ids, like `["bworld:dark_forest", "bworld:swamp"]`. See [World Generation](../worldgen/index.md#terrain). |
|
||||
| `chance` | `1` | The chance a spawn that passed every other check goes ahead. The Undergarden gives its rotspawn 1 in 10. |
|
||||
|
||||
Every tick, the server makes one try in each chunk within 6 chunks of a player that their client has loaded:
|
||||
|
||||
1. It picks a random spot in the chunk, anywhere from the bottom of the world to just above the surface, so most spawns
|
||||
are in caves.
|
||||
2. From there, up to 3 groups wander up to 5 blocks a step at that height. The first spot of a group picks a spawn by
|
||||
`weight` from the ones for its biome, and the group tries to spawn between `min_count` and `max_count` of it, at most
|
||||
4 from one try.
|
||||
3. Each spot has to be at least 24 blocks from every player and from the world spawn, on top of a whole solid block (not
|
||||
leaves, glass or a block that gives off light 14 or more), with room for the entity's box and no water in it.
|
||||
4. It has to be dark: no block light at all, and less likely the more sky light there is. Under the open sky monsters
|
||||
only spawn at night.
|
||||
|
||||
There are at most 70 monsters for the 17x17 chunks around a player, fewer when fewer chunks are loaded. Monsters that
|
||||
never despawn (named, riding or ridden, or that picked up an item) don't count. Like any monster, they despawn when no
|
||||
player is near.
|
||||
|
||||
## Spawning From Scripts
|
||||
|
||||
```ts
|
||||
|
||||
@@ -19,6 +19,7 @@ mods/
|
||||
recipes/*.json
|
||||
tags/<registry>/<namespace>/*.json # tags, see resources/tags.md
|
||||
worldgen/ores.json
|
||||
worldgen/spawns.json # monsters that spawn on their own, see entities/index.md
|
||||
textures/*.png
|
||||
scripts/
|
||||
server.ts # game logic, never sent to players
|
||||
|
||||
Reference in New Issue
Block a user