More fluid apis
This commit is contained in:
@@ -98,12 +98,17 @@ Server and client scripts have `ctx.fluids`, which goes through the rules:
|
||||
|
||||
```ts
|
||||
const birch = { id: "copper_tools:syrup", data: { tree: "bworld:birch_log" } };
|
||||
ctx.fluids.ids(); // every fluid's id in load order, like ["bworld:juice", "copper_tools:syrup"]
|
||||
ctx.fluids.exists("copper_tools:syrup"); // true
|
||||
ctx.fluids.name(birch); // "Birch Log Syrup"
|
||||
ctx.fluids.color(birch); // "#d9a441"
|
||||
ctx.fluids.same(birch, { id: "copper_tools:syrup" }); // false, the data is different
|
||||
```
|
||||
|
||||
`ids` gives each fluid once, without data, so a fluid that's many things by its data, like syrup from each tree, is only
|
||||
there as plain `copper_tools:syrup`. Client scripts also have `ctx.fluids.mod(id)`, the name of the mod that added it,
|
||||
like `ctx.items.mod`.
|
||||
|
||||
## Containers
|
||||
|
||||
An item with `fluid_container` holds one fluid, full or empty, like a bucket or a bottle:
|
||||
|
||||
Reference in New Issue
Block a user