Smithing table
This commit is contained in:
@@ -349,8 +349,23 @@ clients as part of the container it's in, so client screens can show it.
|
||||
| `type` | Fields | Notes |
|
||||
| --------- | ---------------------------------------------------------------------------------- | ---------------------------------------------------------------------------- |
|
||||
| `shaped` | `pattern` rows (space is empty), `key` letter to item id, `result` `{ id, count }` | Fits anywhere in the 3×3 grid, like the recipes in `server/game/crafting.ts` |
|
||||
| `furnace` | `input` item id, `output` `{ id, count }`, `cook_time` in ticks | Same as `FURNACE_RECIPES` in `server/game/blocks.ts` |
|
||||
| `fuel` | `item` id, `burn_time` in ticks | Same as `FUEL_VALUES` in `server/game/blocks.ts` |
|
||||
| `furnace` | `input` item id, `output` `{ id, count }`, `cook_time` in ticks | Used by the furnace |
|
||||
| `fuel` | `item` id, `burn_time` in ticks | Used by the furnace |
|
||||
| `smithing` | `tool` item id, `material` `{ id, count }`, optional `addition` item id, `result` item id | Used by the smithing table: upgrades the tool, keeping its data. Uses up the tool, `count` of the material and the addition |
|
||||
|
||||
A smithing recipe, `recipes/smithing_stone_pickaxe.json`:
|
||||
|
||||
```json
|
||||
{
|
||||
"format_version": 1,
|
||||
"recipe": {
|
||||
"type": "smithing",
|
||||
"tool": "bworld:wood_pickaxe",
|
||||
"material": { "id": "bworld:stone", "count": 5 },
|
||||
"result": "bworld:stone_pickaxe"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
A shaped recipe, for the crafting grid in the player's inventory screen:
|
||||
|
||||
@@ -366,7 +381,8 @@ A shaped recipe, for the crafting grid in the player's inventory screen:
|
||||
}
|
||||
```
|
||||
|
||||
Two furnace recipes with the same `input`, or two shaped recipes with the same pattern and key, are a load error. Server
|
||||
Two furnace recipes with the same `input`, two smithing recipes with the same tool, material and addition, or two
|
||||
shaped recipes with the same pattern and key, are a load error. Server
|
||||
scripts can also register recipe types of their own through `ctx.recipes`.
|
||||
|
||||
## Server scripts
|
||||
@@ -655,7 +671,9 @@ ctx.components.register_block("copper_tools:smelter", {
|
||||
can be fractional. `rows` sets its height, by default it fits the slots and bars.
|
||||
- `filter` is a function `(item) => boolean` or one of the built-in filters `"smeltable"` (has a furnace recipe) and
|
||||
`"fuel"`. It and `output_only` run **on the server**, so players can't put the wrong items in by editing their client.
|
||||
`output_only` slots can only be taken from, all at once, like the furnace result.
|
||||
`output_only` slots can only be taken from, all at once, like the furnace result. Their `on_take(item)` runs when a
|
||||
player takes from one, before they get it: return `false` to stop them, or use up the inputs there so they're gone in
|
||||
the same step (the smithing table does this).
|
||||
- `bars` are progress bars filled with `value / max`, both names of properties set with `screen.set_property(id, n)`.
|
||||
`direction` is `"up"` (like the furnace's fire) or `"right"` (like its arrow). Properties are synced when they change,
|
||||
so a component can update them every tick.
|
||||
|
||||
Reference in New Issue
Block a user