Rename all "liquid" mentions to "fluid"

This commit is contained in:
2026-10-25 13:54:53 -03:00
parent bcca8fa4a5
commit 0cfa4d9b4a
58 changed files with 547 additions and 548 deletions
+16 -16
View File
@@ -87,7 +87,7 @@ when what it hangs from is gone. A block whose states follow from its neighbors,
clients see it change right away.
`on_state_change` runs when the block's states change and it stays the same block: a script's `ctx.world.set_state`, a
rule, a liquid's level. `before` is every state as it was, by name, and `ctx.world.get_state` gives what they are now.
rule, a fluid's level. `before` is every state as it was, by name, and `ctx.world.get_state` gives what they are now.
It's how a block reacts to a state something else sets on it, like a machine another mod's script turns off. It runs
right away, before the blocks beside it are told, like `on_create`. Replacing the block with `set_block` runs `on_break`
and `on_create` instead, and setting a state to what it already is runs nothing.
@@ -296,20 +296,20 @@ catch up. If it's further behind than that, it skips the rest and logs a warning
`mods/bworld/scripts/server.ts` registers these, and any mod that depends on `bworld` can use them:
| Component | Params | What it does |
| ----------------------- | --------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `bworld:storage` | `rows` | A chest: `rows` × 9 slots, dropped when it's broken. |
| `bworld:shipping_bin` | `rows` | Like `bworld:storage`, and every morning at 06:00 sells what's in it with a `base_sell_value` for coins. |
| `bworld:furnace` | none | Smelts with `furnace` and `fuel` [recipes](../resources/recipes.md). Needs `lit` and `facing` states, see `blocks/furnace.json`. |
| `bworld:smithing_table` | none | Upgrades tools with `smithing` recipes. |
| `bworld:stonecutter` | none | Cuts one item into another with `bworld:stonecutting` recipes, picked from a list. |
| `bworld:hoeable` | `tool`, `into` | Right clicking with a tool of type `tool` turns it into `into`, like a hoe on grass. |
| `bworld:farmland` | none | Watered with the watering can, dries out every morning. |
| `bworld:crop` | see [Crops](crops.md) | Grows a stage every morning its farmland was watered. |
| `bworld:crop_top` | see [Crops](crops.md) | The top half of a two block crop, like rice. |
| `bworld:water_source` | none | Refills the watering can. |
| `bworld:fishable` | `loot_table`? | The fishing rod's hook floats on it and fish bite there when it lands in it. What's caught is `loot_table`, `bworld:gameplay/fishing` when not given, built from the fish whose `liquid` is this block. |
| `bworld:trapdoor` | none | Opens and closes when right clicked, and is placed like Minecraft's (both are rules, in the shared script). Needs `facing` (2 bits), `half` and `open` states, see `blocks/oak_trapdoor.json`. |
| `bworld:fence` | `connects_to` | Joins the blocks in the tag `connects_to` and sturdy sides of other blocks, except leaves. Needs the `north`, `east`, `south` and `west` states. |
| Component | Params | What it does |
| ----------------------- | --------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `bworld:storage` | `rows` | A chest: `rows` × 9 slots, dropped when it's broken. |
| `bworld:shipping_bin` | `rows` | Like `bworld:storage`, and every morning at 06:00 sells what's in it with a `base_sell_value` for coins. |
| `bworld:furnace` | none | Smelts with `furnace` and `fuel` [recipes](../resources/recipes.md). Needs `lit` and `facing` states, see `blocks/furnace.json`. |
| `bworld:smithing_table` | none | Upgrades tools with `smithing` recipes. |
| `bworld:stonecutter` | none | Cuts one item into another with `bworld:stonecutting` recipes, picked from a list. |
| `bworld:hoeable` | `tool`, `into` | Right clicking with a tool of type `tool` turns it into `into`, like a hoe on grass. |
| `bworld:farmland` | none | Watered with the watering can, dries out every morning. |
| `bworld:crop` | see [Crops](crops.md) | Grows a stage every morning its farmland was watered. |
| `bworld:crop_top` | see [Crops](crops.md) | The top half of a two block crop, like rice. |
| `bworld:water_source` | none | Refills the watering can. |
| `bworld:fishable` | `loot_table`? | The fishing rod's hook floats on it and fish bite there when it lands in it. What's caught is `loot_table`, `bworld:gameplay/fishing` when not given, built from the fish whose `fluid` is this block. |
| `bworld:trapdoor` | none | Opens and closes when right clicked, and is placed like Minecraft's (both are rules, in the shared script). Needs `facing` (2 bits), `half` and `open` states, see `blocks/oak_trapdoor.json`. |
| `bworld:fence` | `connects_to` | Joins the blocks in the tag `connects_to` and sturdy sides of other blocks, except leaves. Needs the `north`, `east`, `south` and `west` states. |
Item components work the same way, see [Items](../items/index.md#item-components).
+33 -34
View File
@@ -53,7 +53,7 @@ there will be holes in the world behind them.
| Field | Default | Meaning |
| ---------------------- | ----------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `collision` | `true` | Whether entities bump into it. Plants set `false`, and liquids default to it. |
| `collision` | `true` | Whether entities bump into it. Plants set `false`, and fluids 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. |
@@ -65,13 +65,13 @@ there will be holes in the world behind them.
| `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. |
| `scrollable` | `false` | The mouse wheel turned while looking at it goes to its components' `on_scroll` instead of the hotbar, see [Scrolling](components.md#scrolling). |
| `replaceable` | `false` | Placing a block into it replaces it, like water. Liquids default to `true`. |
| `replaceable` | `false` | Placing a block into it replaces it, like water. Fluids 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). |
| `fluid` | none | Makes it a fluid, like water. See [Fluids](#fluids). |
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.
@@ -129,11 +129,10 @@ 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
## Fluids
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.
A block with `fluid` is a fluid, like water. The engine draws it like Luanti's fluids: each corner of its surface is as
high as the fluid 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`:
@@ -145,7 +144,7 @@ shore.
"textures": { "still": "oily:oil_still", "flowing": "oily:oil_flowing" },
"render_layer": "translucent",
"alpha": 0.9,
"liquid": { "range": 4 }
"fluid": { "range": 4 }
}
}
```
@@ -154,9 +153,9 @@ shore.
top. `flowing` is on its sides and on a sloping top, turned to run downhill. A block shows as many of `flowing`'s
pixels across as `still` has, so a 32×32 `flowing` next to a 16×16 `still` spreads over two blocks. With one texture,
it's all of that texture on every side. Either can be [animated](../resources/textures.md#animated-textures).
- `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
- `fluid.range` is how many blocks it flows from a source, 1 to 7, and `7` when not set.
- `fluid.ticks` is how many ticks each step of its flow takes, `5` when not set, like Minecraft's water. Lava's is 30.
- `fluid.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.
@@ -168,43 +167,43 @@ shore.
### Flowing
Liquids flow on the server like Minecraft's water. When a block next to a liquid changes, the cells around it are looked
Fluids flow on the server like Minecraft's water. When a block next to a fluid 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
- With the same fluid above, it's falling, and drawn full.
- Otherwise it's one level more than the lowest of the fluid beside it that spreads sideways, and gone once that's past
`range`. Sources spread sideways, and flowing fluid 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.
`ctx.world.liquid_flow(x, y, z)` says which way the liquid in a block flows, like Minecraft's `FluidState.getFlow`: a
vector 1 long toward the lower liquid beside it, and down where it falls against a wall, or `{ x: 0, y: 0, z: 0 }` where
`ctx.world.fluid_flow(x, y, z)` says which way the fluid in a block flows, like Minecraft's `FluidState.getFlow`: a
vector 1 long toward the lower fluid beside it, and down where it falls against a wall, or `{ x: 0, y: 0, z: 0 }` where
it's still or there's none. It's the same flow that pushes players and items along, for machines it turns, like a water
wheel.
### Waterlogging
A block that isn't a liquid can hold one, like Minecraft's waterlogged fences. `waterloggable` names the liquid:
A block that isn't a fluid can hold one, like Minecraft's waterlogged fences. `waterloggable` names the fluid:
```json
"waterloggable": "bworld:water"
```
- It gets a `waterlogged` [state](states.md) of its own, after any it lists: `1` while it holds a source of the liquid.
- It gets a `waterlogged` [state](states.md) of its own, after any it lists: `1` while it holds a source of the fluid.
It uses one of the block's 16 bits.
- Placed into a source of the liquid, it holds it. Placed into flowing liquid or anything else, it doesn't. With
- Placed into a source of the fluid, it holds it. Placed into flowing fluid or anything else, it doesn't. With
`"waterlogged_only": true` it can only be placed into a source, so it's always placed holding it, like Farmer's
Delight's rice.
- Using the liquid's item on it, like a water bucket, fills it. An item that aims at liquids, like a bucket, uses the
liquid in it instead of the block, so a bucket takes the water back out and the block stays.
- It's a source of the liquid that never drains: the liquid flows out of it, and entities swim and are pushed in it.
Flowing liquid doesn't flow into it.
- Broken, it leaves a source of the liquid behind.
- Raycasts with `liquids` other than `"none"` hit the liquid in it, filling the block, and say the liquid's id.
- Using the fluid's item on it, like a water bucket, fills it. An item that aims at fluids, like a bucket, uses the
fluid in it instead of the block, so a bucket takes the water back out and the block stays.
- It's a source of the fluid that never drains: the fluid flows out of it, and entities swim and are pushed in it.
Flowing fluid doesn't flow into it.
- Broken, it leaves a source of the fluid behind.
- Raycasts with `fluids` other than `"none"` hit the fluid in it, filling the block, and say the fluid's id.
The base game's wooden fences are waterloggable, and Farmer's Delight's rice is `waterlogged_only`.
@@ -228,22 +227,22 @@ hook uses it to see where it lands, and with a player's
[`eye_position` and `look_direction`](../entities/players.md#the-player-api) it finds what they're looking at:
```ts
const hit = ctx.world.raycast(from, to, { liquids: "any" });
const hit = ctx.world.raycast(from, to, { fluids: "any" });
if (hit && "bworld:fishable" in ctx.blocks.components(hit.id)) {
// hit.x, hit.y, hit.z is the block, hit.face the side it went in by, hit.position the exact point
}
```
It hits what entities bump into, so it goes through plants and other blocks with `"collision": false`. `liquids` is like
It hits what entities bump into, so it goes through plants and other blocks with `"collision": false`. `fluids` is like
Minecraft's `ClipContext.Fluid`:
| `liquids` | Hits |
| ------------------ | ------------------------------------------- |
| `"none"` (default) | No liquids, it goes through them. |
| `"source_only"` | Liquid sources, going through flowing ones. |
| `"any"` | Every liquid. |
| `fluids` | Hits |
| ------------------ | ------------------------------------------ |
| `"none"` (default) | No fluids, it goes through them. |
| `"source_only"` | Fluid sources, going through flowing ones. |
| `"any"` | Every fluid. |
A liquid is hit at its surface, which is lower where it flows. It returns `undefined` when nothing is in the way.
A fluid is hit at its surface, which is lower where it flows. It returns `undefined` when nothing is in the way.
`ctx.blocks.components(id)` gives the components a block's json lists and their params, like `ctx.items.components`, and
`ctx.blocks.exists(id)` whether a block exists.
+1 -1
View File
@@ -71,7 +71,7 @@ const eye = player.eye_position;
const look = player.look_direction;
const reach = player.attribute("bworld:block_interaction_range");
const to = { x: eye.x + look.x * reach, y: eye.y + look.y * reach, z: eye.z + look.z * reach };
const hit = ctx.world.raycast(eye, to, { liquids: "source_only" });
const hit = ctx.world.raycast(eye, to, { fluids: "source_only" });
```
## Health and Hunger
+1 -1
View File
@@ -53,7 +53,7 @@ down to 0 is gone.
| `data_textures` | none | Other textures, picked by the stack's `data`, see below. |
| `model` | none | A [model](../resources/models.md#item-models) it's drawn with instead of its texture. |
| `worn` | none | How it looks worn on a player, see [below](#worn-models). |
| `targets_liquids` | `false` | Players holding it aim at liquids, like buckets and fishing rods. Others aim through. |
| `targets_fluids` | `false` | Players holding it aim at fluids, like buckets and fishing rods. Others aim through. |
| `components` | none | [Item components](#item-components) and their parameters. |
### Textures From Data
+4 -4
View File
@@ -134,9 +134,9 @@ does nothing unless they hold.
## Fishing
The fishing tables aren't files: the base game builds them from every item with the `bworld:fish` component, so a mod
adds a fish by giving its item the component. A fish lives in one liquid, water unless its `liquid` says otherwise, and
is in that liquid's table: the `loot_table` of its `bworld:fishable` component, `bworld:gameplay/fishing` when it
doesn't name one. Water's is `bworld:gameplay/fishing` and lava's is `bworld:gameplay/lava_fishing`:
adds a fish by giving its item the component. A fish lives in one fluid, water unless its `fluid` says otherwise, and is
in that fluid's table: the `loot_table` of its `bworld:fishable` component, `bworld:gameplay/fishing` when it doesn't
name one. Water's is `bworld:gameplay/fishing` and lava's is `bworld:gameplay/lava_fishing`:
```json
"components": {
@@ -153,7 +153,7 @@ doesn't name one. Water's is `bworld:gameplay/fishing` and lava's is `bworld:gam
| ------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `weight` | How often it's caught against the other fish, 1 when not given. |
| `seasons` | The [seasons](../worldgen/biomes.md#seasons) it's caught in where the hook is, every one when not given. |
| `liquid` | The `bworld:fishable` block it's caught in, `bworld:water` when not given, like `"bworld:lava"`. |
| `fluid` | The `bworld:fishable` block it's caught in, `bworld:water` when not given, like `"bworld:lava"`. |
| `biomes` | The [biomes](../worldgen/biomes.md#biome-ids) and [biome tags](../worldgen/biomes.md#biome-tags) it's caught in where the hook is, every one when not given. |
| `time` | The hours it's caught at on a 24 hour clock, from `from` up to `to`, like `6.5` for 06:30. When `from` is past `to` it wraps around midnight. All day when not given. |
| `minigame` | What the player does to land it once it's reeled in, in a screen that holds the fish until they win. Closing it lets the fish get away. Caught right away when not given. The base game's are `"test"`, a Catch button, `"hold"`, a bar that fills while the mouse is held and empties while it isn't: full lands the fish, empty loses it, `"valley"`, Stardew Valley's, where holding the mouse lifts a bar to keep the fish in it, `"ring"`, where a green ring grows out toward gray ones and clicking while it's inside each lands the fish, `"maze"`, where the mouse goes from the start to the end of a maze without touching its walls, in 8 seconds, and `"chess"`, a mate in one from Lichess's puzzles to find in 8 seconds. |
+9 -9
View File
@@ -161,15 +161,15 @@ Built in names work with or without `minecraft:`.
| `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. |
| 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 fluid. |
| `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`.