Session: recipes
cinnabar:session/recipes@0.1.0
The recipes the server sent that the client decodes, as the vanilla recipe book and the
station screens use them. Every function errs only when the recipes permission is denied.
Grants: recipes.
Imported type item-key: item-key.
Imported type stack: stack.
Types
ingredient-kind
An exact item, an identifier accepting any aux value, or an item tag.
variant ingredient-kind {
item(item-key),
any-aux(string),
tag(string),
}
| Member | Type | Description |
|---|---|---|
item | item-key | |
any-aux | string | Any aux value of this identifier (aux 32767 on the wire). |
tag | string | Any member of this item tag. |
Types: item-key.
ingredient
One required ingredient and its stack count; empty shaped cells are represented outside this record.
record ingredient {
kind: ingredient-kind,
count: u8,
}
| Member | Type | Description |
|---|---|---|
kind | ingredient-kind | |
count | u8 |
Types: ingredient-kind.
category
The recipe station or transformation family, preserving its distinct ingredient ordering.
enum category {
crafting,
stonecutter,
cartography,
smithing-transform,
smithing-trim,
furnace,
blast-furnace,
smoker,
brewing,
}
| Member | Type | Description |
|---|---|---|
crafting | ||
stonecutter | ||
cartography | ||
smithing-transform | ||
smithing-trim | ||
furnace | ||
blast-furnace | ||
smoker | ||
brewing | The brewing stand: the input potion, then the reagent. Brewing has no network id (0). |
recipe
One decoded recipe with station-specific input order and resolved output stacks.
record recipe {
network-id: u32,
category: category,
shapeless: bool,
width: u8,
height: u8,
ingredients: list<option<ingredient>>,
outputs: list<stack>,
}
| Member | Type | Description |
|---|---|---|
network-id | u32 | |
category | category | |
shapeless | bool | |
width | u8 | A shaped crafting recipe’s size; zero otherwise. |
height | u8 | |
ingredients | list<option<ingredient>> | Shaped: width * height cells, row-major, none for an empty cell. Otherwise theinputs in order: stonecutter and furnaces the input; cartography the map, then the modifier; smithing the template, the base, then the addition. |
outputs | list<stack> | Empty for a smithing trim, which decorates its base. |
Types: category, ingredient, stack.
Functions
revision
revision: func() -> result<u64, string>;
Changes whenever the server resends its recipes.
count
count: func() -> result<u32, string>;
Returns the number of currently decoded session recipes.
page
page: func(start: u32, count: u32) -> result<list<recipe>, string>;
Up to count recipes from start, cut to the host’s per-call cap.
Types: recipe.