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,
}
| Member | Type | Description |
|---|---|---|
identifier | string | |
aux | u16 |
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,
}
| Member | Type | Description |
|---|---|---|
key | item-key | |
icon | s64 | |
count | u8 |
Types: item-key.
category
The creative inventory tab an item’s group belongs to.
enum category {
construction,
nature,
equipment,
items,
command-only,
}
| Member | Type | Description |
|---|---|---|
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>,
}
| Member | Type | Description |
|---|---|---|
key | item-key | |
icon | s64 | |
name | string | The localized display name. |
group | option<string> | The creative group’s name (a language key), when the item is in a named group. |
category | option<category> | None for an item absent from the creative content. |
max-stack | u8 | |
tags | list<string> | The registry’s item tags. |
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.
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.