API reference / @jsprismarine/protocol / DataStoreUpdate
Class: DataStoreUpdate
Defined in: protocol/src/structure/DataStoreUpdate.ts:63
One path of one data store property and its new value, as ClientboundDataStorePacket lists it and ServerboundDataStorePacket carries it.
Protocol 2193 wire order: 0. Data Store Name: string.
Property: string.Path: string.Data: a Cereal tagged variant. A varuint32 selector with the values of DataStoreValueType, then the alternative: a little-endian double, one boolean byte, or a string.Property Update Count: little-endian uint32.Path Update Count: little-endian uint32. Strings are a varuint32 byte length followed by UTF-8.
The two counts replaced a single Update Count at 1.26.0. https://mojang.github.io/bedrock-protocol-docs/1.26.51/types/data-store-update/
Extends
Implements
Constructors
Constructor
new DataStoreUpdate(
dataStoreName?,property?,path?,data?,propertyUpdateCount?,pathUpdateCount?):DataStoreUpdate
Defined in: protocol/src/structure/DataStoreUpdate.ts:74
Creates an update from its fields. Every parameter has a default so the static deserialize can construct an empty instance before reading the stream.
Parameters
dataStoreName?
string = ''
Data Store Name.
property?
string = ''
Property within the data store.
path?
string = ''
Path within the property.
data?
DataStoreValue = ...
Data, the typed value.
propertyUpdateCount?
number = 0
Property Update Count.
pathUpdateCount?
number = 0
Path Update Count.
Returns
DataStoreUpdate
Overrides
Properties
data
data:
DataStoreValue
Defined in: protocol/src/structure/DataStoreUpdate.ts:78
Data, the typed value.
Implementation of
dataStoreName
dataStoreName:
string=''
Defined in: protocol/src/structure/DataStoreUpdate.ts:75
Data Store Name.
Implementation of
DataStoreUpdateData.dataStoreName
path
path:
string=''
Defined in: protocol/src/structure/DataStoreUpdate.ts:77
Path within the property.
Implementation of
pathUpdateCount
pathUpdateCount:
number=0
Defined in: protocol/src/structure/DataStoreUpdate.ts:80
Path Update Count.
Implementation of
DataStoreUpdateData.pathUpdateCount
property
property:
string=''
Defined in: protocol/src/structure/DataStoreUpdate.ts:76
Property within the data store.
Implementation of
propertyUpdateCount
propertyUpdateCount:
number=0
Defined in: protocol/src/structure/DataStoreUpdate.ts:79
Property Update Count.
Implementation of
DataStoreUpdateData.propertyUpdateCount
Methods
deserialize()
deserialize(
stream):void
Defined in: protocol/src/structure/DataStoreUpdate.ts:110
Reads the six fields in wire order.
Parameters
stream
Returns
void
Throws
Error when the Data selector names no known DataStoreValueType.
Overrides
serialize()
serialize(
stream):void
Defined in: protocol/src/structure/DataStoreUpdate.ts:86
Writes the six fields in wire order, the one-of selector before the value.
Parameters
stream
Returns
void
Overrides
deserialize()
staticdeserialize<T>(this,stream):T
Defined in: protocol/src/NetworkStructure.ts:28
Deserializes the network structure from a binary stream. The constructor runs with no arguments before the stream is read, so the class must tolerate that.
Type Parameters
T
T extends NetworkStructure
Parameters
this
Constructor<T>
stream
The binary stream to deserialize from.
Returns
T
An instance of the class T.