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

Screen

cinnabar:extension/screen@0.1.0

The mod’s JSON-UI templates beside the vanilla container screens. Templates are the ui/<name>.json files mod.toml indexes, in the mod’s own namespace; they resolve only against the vanilla catalog, as a client part’s modal templates do. Every mutation errs when the screen permission is denied.

Grants: screen for mutations; layout, held-modifiers and elapsed-seconds need no grant.

Imported type value: value.

Imported type gui-size: gui-size.

Types

rect

A rectangle in GUI units, from the top left of the screen root.

record rect {
    x: f64,
    y: f64,
    width: f64,
    height: f64,
}
MemberTypeDescription
xf64
yf64
widthf64
heightf64

screen-layout

The open container screen as laid out for this frame.

record screen-layout {
    screen: string,
    size: gui-size,
    gui: rect,
    exclusions: list<rect>,
    view: option<rect>,
}
MemberTypeDescription
screenstringThe vanilla JSON-UI screen drawn, such as crafting.inventory_screen.
sizegui-sizeThe root’s size in GUI units and the GUI scale, as ui.modal-size reports them.
guirectThe union of the vanilla screen’s laid-out panels, an open recipe book included.
exclusionslist<rect>Other vanilla areas outside gui that the overlay may not draw on: the recipe book’s
tabs, the status effects and toasts.
viewoption<rect>The open view’s laid-out bounds. While the view is up the vanilla screen is hidden,
and the overlay is clipped against this rect (and the exclusions) instead of gui.

Types: gui-size, rect.

modifiers

The modifier keys held with a wheel turn.

flags modifiers {
    ctrl,
    shift,
    alt,
}
MemberTypeDescription
ctrl
shift
alt

Functions

layout

layout: func() -> option<screen-layout>;

The open container screen’s layout; none while no container screen is up.

Types: screen-layout.

set-overlay

set-overlay: func(template: option<string>) -> result<_, string>;

Draws template beside every container screen, laid out over the whole root but drawn and hit only outside gui and the exclusions; none removes it.

open-view

open-view: func(template: option<string>) -> result<_, string>;

Draws template over the open container screen, which stays open and is hidden while the view is up; none, Escape or closing the container returns. Errs while no container screen is up.

set-collection

set-collection: func(name: string, rows-json: list<u8>) -> result<_, string>;

Replaces a collection’s rows, as client WIT 1.2’s ui.set-collection.

set-value

set-value: func(name: string, value: value) -> result<_, string>;

Binds one #binding name for the overlay and the view, as ui.set-value.

Types: value.

set-text

set-text: func(control: string, text: string) -> result<_, string>;

Sets the text of edit boxes named control, as ui.set-text.

focus-text

focus-text: func(control: string) -> result<_, string>;

Selects the drawn edit box named control, as a press on it would.

held-modifiers

held-modifiers: func() -> modifiers;

The modifier keys held with the event being delivered, such as Shift with a press.

Types: modifiers.

elapsed-seconds

elapsed-seconds: func() -> f64;

Monotonic seconds since the mod loaded, to animate by, as JEI cycles ingredients.