Skip to content

API reference / @jsprismarine/prismarine / scripting/DataDrivenScreens / VariableScreens

Class: VariableScreens ​

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

The screens of a client at protocol 2259 or later, whose data store holds variables rather than properties: each value of a screen is a variable named minecraft.<property>.<path>, set by a Data Store Change with its own update count. A change to a path sends that variable again with the count one higher, and a screen the client reports closed has every variable removed. BDS takes a client's write only when its count is higher than the variable's.

Implements ​

Constructors ​

Constructor ​

new VariableScreens(send): VariableScreens

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

Parameters ​

send ​

(packet) => void

Sends one packet to the client.

Returns ​

VariableScreens

Methods ​

close() ​

close(formId): void

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

Asks the client to close one screen.

Parameters ​

formId ​

number

Returns ​

void

Implementation of ​

DataDrivenScreens.close


closed() ​

closed(formId): boolean

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

Takes a client's report that a screen closed and clears its property; false when it was not open.

Parameters ​

formId ​

number

Returns ​

boolean

Implementation of ​

DataDrivenScreens.closed


show() ​

show(formId, screen): void

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

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

Parameters ​

formId ​

number

screen ​

DataDrivenScreen

Returns ​

void

Implementation of ​

DataDrivenScreens.show


update() ​

update(property, __namedParameters): void

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

Changes one path of a property the client was sent.

Parameters ​

property ​

string

__namedParameters ​

DataDrivenPathValue

Returns ​

void

Implementation of ​

DataDrivenScreens.update


written() ​

written(__namedParameters): DataDrivenWrite | undefined

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

Takes a client's write to a path of an open screen's property; undefined when it names none or is stale.

Parameters ​

__namedParameters ​
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

Implementation of ​

DataDrivenScreens.written