Skip to content

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.

  1. Property: string.
  2. Path: string.
  3. 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.
  4. Property Update Count: little-endian uint32.
  5. 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 ​

NetworkStructure.constructor

Properties ​

data ​

data: DataStoreValue

Defined in: protocol/src/structure/DataStoreUpdate.ts:78

Data, the typed value.

Implementation of ​

DataStoreUpdateData.data


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 ​

DataStoreUpdateData.path


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 ​

DataStoreUpdateData.property


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 ​

NetworkBinaryStream

Returns ​

void

Throws ​

Error when the Data selector names no known DataStoreValueType.

Overrides ​

NetworkStructure.deserialize


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 ​

NetworkBinaryStream

Returns ​

void

Overrides ​

NetworkStructure.serialize


deserialize() ​

static deserialize<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 ​

NetworkBinaryStream

The binary stream to deserialize from.

Returns ​

T

An instance of the class T.

Inherited from ​

NetworkStructure.deserialize