Water flowing
This commit is contained in:
@@ -53,7 +53,7 @@ there will be holes in the world behind them.
|
||||
|
||||
| Field | Default | Meaning |
|
||||
| ---------------------- | ----------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `collision` | `true` | Whether entities bump into it. Plants and water set `false`. |
|
||||
| `collision` | `true` | Whether entities bump into it. Plants set `false`, and liquids default to it. |
|
||||
| `shape` | its model | The boxes players point at and entities bump into, in pixels. See [Shapes](../resources/models.md#shapes). |
|
||||
| `collision_shape` | `shape` | What entities bump into when it's different, up to 24 pixels high. See [Collision Shapes](../resources/models.md#collision-shapes). |
|
||||
| `mining.toughness` | unbreakable | Seconds to break by hand. Without `mining`, a block can't be broken. |
|
||||
@@ -63,12 +63,13 @@ there will be holes in the world behind them.
|
||||
| `drops` | nothing | The item id it drops when broken. |
|
||||
| `item` | `true` | Also register an item that places it, with the same id. To give that item more, see [Block Items](../items/index.md#block-items). |
|
||||
| `interactive` | `false` | Right clicking it does something, like opening a screen, so clients don't guess that it places a block. |
|
||||
| `replaceable` | `false` | Placing a block into it replaces it, like water. |
|
||||
| `replaceable` | `false` | Placing a block into it replaces it, like water. Liquids default to `true`. |
|
||||
| `place_in` | see meaning | Block ids or [tags](../resources/tags.md) it can be placed into, replacing them, like `["bworld:water"]` for rice. Air and `replaceable` blocks when not set. |
|
||||
| `place_on` | anywhere | Block ids or [tags](../resources/tags.md) it can stand on, like `["bworld:hoed_dirt"]` for crops or `["#bworld:logs"]`. See [below](#placement). |
|
||||
| `states` | none | Named [state](states.md) bits, like a crop's age. |
|
||||
| `components` | none | [Components](components.md) and their parameters. |
|
||||
| `item_display` | none | Shows an item on top of it, see [Tile Data](tiledata.md#showing-an-item). |
|
||||
| `liquid` | none | Makes it a liquid, like water. See [Liquids](#liquids). |
|
||||
|
||||
A block's definition goes to every player, since clients need it to draw the block, time breaking and collide with it.
|
||||
It can't hold functions.
|
||||
@@ -97,6 +98,54 @@ crop when its farmland is dug up.
|
||||
|
||||
Food that places a block, like potatoes, is planted when clicked somewhere it can go and eaten otherwise.
|
||||
|
||||
## Liquids
|
||||
|
||||
A block with `liquid` is a liquid, like water. The engine draws it like Luanti's liquids: each corner of its surface is
|
||||
as high as the liquid around it, so it slopes down from a source to where it flows, and it thins out to a film at the
|
||||
shore.
|
||||
|
||||
`mods/oily/blocks/oil.json`:
|
||||
|
||||
```json
|
||||
{
|
||||
"format_version": 1,
|
||||
"block": {
|
||||
"id": "oily:oil",
|
||||
"textures": { "still": "oily:oil_still", "flowing": "oily:oil_flowing" },
|
||||
"render_layer": "translucent",
|
||||
"alpha": 0.9,
|
||||
"liquid": { "range": 4 }
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
- `textures` is one texture, or `{ still, flowing }`: `still` on its top and bottom, `flowing` on its sides, like
|
||||
Luanti's special tiles.
|
||||
- `liquid.range` is how many blocks it flows from a source, 1 to 7, and `7` when not set.
|
||||
- `liquid.ticks` is how many ticks each step of its flow takes, `5` when not set, like Minecraft's water. Lava's is 30.
|
||||
- `liquid.renewable`, `true` when not set: a spot with two sources beside it and something solid or a source under it
|
||||
becomes a source too, like Minecraft's infinite water.
|
||||
- It gets a `level` [state](states.md) of its own, after any it lists: `0` is a source, a full block, and `1` up to
|
||||
`range` as it flows away from one, each lower.
|
||||
- `collision` defaults to `false` and `replaceable` to `true`. Entities swim in it and falling into it doesn't hurt.
|
||||
- It can't have a `model`, `variants`, `parts`, `shape`, `collision_shape` or `item_model`, since the engine draws it.
|
||||
- `tint` works on the `still` and `flowing` textures.
|
||||
|
||||
### Flowing
|
||||
|
||||
Liquids flow on the server like Minecraft's water. When a block next to a liquid changes, the cells around it are looked
|
||||
at again after its `ticks`, and each works out what it should be:
|
||||
|
||||
- A source stays a source.
|
||||
- With the same liquid above, it's falling, and drawn full.
|
||||
- Otherwise it's one level more than the lowest of the liquid beside it that spreads sideways, and gone once that's past
|
||||
`range`. Sources spread sideways, and flowing liquid only does when it's on something solid: over air or more of
|
||||
itself, it falls instead.
|
||||
|
||||
So it spreads one block a step, falls off edges and spreads again where it lands, and drains away a step at a time once
|
||||
its source is gone. It only flows into air, and stops at chunks that aren't loaded. Buckets only pick up sources. Flows
|
||||
still going when the server stops don't carry on after it starts again until something next to them changes.
|
||||
|
||||
## Tinting
|
||||
|
||||
`tint` draws a block's textures in a color, for textures painted in greys:
|
||||
|
||||
Reference in New Issue
Block a user