Skip to content

API reference / @jsprismarine/prismarine / scripting/DataDrivenScreens

scripting/DataDrivenScreens ​

Classes ​

Interfaces ​

DataDrivenScreens ​

Defined in: packages/prismarine/src/scripting/DataDrivenScreens.ts:93

One client's @minecraft/server-ui data-driven screens on the wire, as the pinned Bedrock Dedicated Server sends them at the client's protocol. A screen is one property of the client's minecraft data store, which the server sets before it tells the client to show the screen; a bound observable changes one path of it, and a screen the client reports closed has the property cleared. The data-driven-forms scenario of packages/parity records these.

Methods ​

close() ​

close(formId): void

Defined in: packages/prismarine/src/scripting/DataDrivenScreens.ts:99

Asks the client to close one screen.

Parameters ​
formId ​

number

Returns ​

void

closed() ​

closed(formId): boolean

Defined in: packages/prismarine/src/scripting/DataDrivenScreens.ts:109

Takes a client's report that a screen closed, and clears the screen's property.

Parameters ​
formId ​

number

Returns ​

boolean

Whether the client had the screen open.

show() ​

show(formId, screen): void

Defined in: packages/prismarine/src/scripting/DataDrivenScreens.ts:95

Sets the screen's property, sends the updates that follow it, and opens the screen.

Parameters ​
formId ​

number

screen ​

DataDrivenScreen

Returns ​

void

update() ​

update(property, change): void

Defined in: packages/prismarine/src/scripting/DataDrivenScreens.ts:97

Changes one path of a property the client was sent.

Parameters ​
property ​

string

change ​

DataDrivenPathValue

Returns ​

void

written() ​

written(payload): DataDrivenWrite | undefined

Defined in: packages/prismarine/src/scripting/DataDrivenScreens.ts:104

Takes a client's write to a path of an open screen's property.

Parameters ​
payload ​
update ​

DataStoreUpdate | null = ...

Update before protocol 2259, the single data store update the client applies. null from 2259.

variableUpdate ​

DataStoreVariableUpdate | null = ...

Update from protocol 2259, keyed by variable name. null before 2259.

Returns ​

DataDrivenWrite | undefined

The write, or undefined when it names no screen the client has open or is stale.


DataDrivenWrite ​

Defined in: packages/prismarine/src/scripting/DataDrivenScreens.ts:80

A client's write to one path of an open screen's property.

Properties ​

path ​

readonly path: string

Defined in: packages/prismarine/src/scripting/DataDrivenScreens.ts:82

property ​

readonly property: string

Defined in: packages/prismarine/src/scripting/DataDrivenScreens.ts:81

value ​

readonly value: DataDrivenLeaf

Defined in: packages/prismarine/src/scripting/DataDrivenScreens.ts:83

Variables ​

SCREEN_DATA_STORE ​

const SCREEN_DATA_STORE: "minecraft" = 'minecraft'

Defined in: packages/prismarine/src/scripting/DataDrivenScreens.ts:30

The data store every @minecraft/server-ui screen's property lives in, as BDS names it.

Functions ​

closeReasonOf() ​

closeReasonOf(reason): DataDrivenCloseReason

Defined in: packages/prismarine/src/scripting/DataDrivenScreens.ts:42

A client's close reason as the script host spells it.

Parameters ​

reason ​

DataDrivenScreenClosedReason

Returns ​

DataDrivenCloseReason


dataDrivenScreensFor() ​

dataDrivenScreensFor(protocolVersion, send): DataDrivenScreens

Defined in: packages/prismarine/src/scripting/DataDrivenScreens.ts:381

The screens of a client at a protocol, in the data store layout its protocol uses: properties up to 2225, variables from 2259.

Parameters ​

protocolVersion ​

number

send ​

(packet) => void

Sends one packet to the client.

Returns ​

DataDrivenScreens


dataDrivenScreensOf() ​

dataDrivenScreensOf(session): DataDrivenScreens

Defined in: packages/prismarine/src/scripting/DataDrivenScreens.ts:390

A session's data-driven screens, the same object for as long as it is connected.

Parameters ​

session ​

PlayerSession

Returns ​

DataDrivenScreens


propertyValueOf() ​

propertyValueOf(value): DataStorePropertyValue

Defined in: packages/prismarine/src/scripting/DataDrivenScreens.ts:48

A screen's value as a Data Store Change carries it: a record is a map, an array a list, a bigint an int64 and any other number a double.

Parameters ​

value ​

DataDrivenValue

Returns ​

DataStorePropertyValue


variablesOf() ​

variablesOf(screen): [string, DataDrivenLeaf][]

Defined in: packages/prismarine/src/scripting/DataDrivenScreens.ts:254

A property's variables at protocol 2259, in the order the pinned BDS sends them: each value of a control or group under its path, such as layout[0].text, and the layout's length as a double. A UIRawMessage travels as its JSON text and a newline, after a <path>.__is_object flag, and a dropdown's items as JSON text after a <path>.__is_array flag. A custom form also carries top_close_button_visible.

Parameters ​

screen ​

DataDrivenScreen

Returns ​

[string, DataDrivenLeaf][]