Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

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),
}
MemberTypeDescription
itemitem-key
any-auxstringAny aux value of this identifier (aux 32767 on the wire).
tagstringAny 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,
}
MemberTypeDescription
kindingredient-kind
countu8

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,
}
MemberTypeDescription
crafting
stonecutter
cartography
smithing-transform
smithing-trim
furnace
blast-furnace
smoker
brewingThe 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>,
}
MemberTypeDescription
network-idu32
categorycategory
shapelessbool
widthu8A shaped crafting recipe’s size; zero otherwise.
heightu8
ingredientslist<option<ingredient>>Shaped: width * height cells, row-major, none for an empty cell. Otherwise the
inputs in order: stonecutter and furnaces the input; cartography the map, then the modifier;
smithing the template, the base, then the addition.
outputslist<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.