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: items

cinnabar:session/items@0.1.0

The session’s items as the vanilla creative screen and recipe book know them: the server’s creative content in its order, then every other item the item registry names, by network id. Every function errs only when the items permission is denied.

Grants: items.

Types

item-key

An item by identifier and aux value (metadata).

record item-key {
    identifier: string,
    aux: u16,
}
MemberTypeDescription
identifierstring
auxu16

stack

A stack. icon is vanilla’s #item_id_aux (network id << 16 | aux): bound as #item_id_aux in a collection row, an item_renderer draws the item.

record stack {
    key: item-key,
    icon: s64,
    count: u8,
}
MemberTypeDescription
keyitem-key
icons64
countu8

Types: item-key.

category

The creative inventory tab an item’s group belongs to.

enum category {
    construction,
    nature,
    equipment,
    items,
    command-only,
}
MemberTypeDescription
construction
nature
equipment
items
command-only

item

One catalog entry, retaining creative placement only when the server supplied it.

record item {
    key: item-key,
    icon: s64,
    name: string,
    group: option<string>,
    category: option<category>,
    max-stack: u8,
    tags: list<string>,
}
MemberTypeDescription
keyitem-key
icons64
namestringThe localized display name.
groupoption<string>The creative group’s name (a language key), when the item is in a named group.
categoryoption<category>None for an item absent from the creative content.
max-stacku8
tagslist<string>The registry’s item tags.

Types: category, item-key.

Functions

revision

revision: func() -> result<u64, string>;

Changes whenever the creative content or the item registry is resent.

count

count: func() -> result<u32, string>;

Returns the number of entries in the current session catalog.

page

page: func(start: u32, count: u32) -> result<list<item>, string>;

Up to count items from start, cut to the host’s per-call cap.

Types: item.

lookup

lookup: func(key: item-key) -> result<option<item>, string>;

Looks up an exact identifier and aux pair; none means it is absent from this catalog.

Types: item-key, item.

tag-members

tag-members: func(tag: string) -> result<list<string>, string>;

The identifiers in an item tag: the registry’s, else the vanilla tag table’s.