Skip to content

API reference / @jsprismarine/protocol / Experiments

Class: Experiments ​

Defined in: protocol/src/structure/Experiments.ts:15

The experiment toggles of a world, as LevelSettings (field 25) and ResourcePackStackPacket carry them.

Protocol 2193 wire order: 0. Toggles: the count as a uint32 LE (the docs mark it "no size compression", so not a varuint), then per toggle a Name string and an Enabled boolean.

  1. ExperimentsEverToggled: boolean, whether any experiment was ever switched on in this world. https://mojang.github.io/bedrock-protocol-docs/1.26.51/types/experiments/

Extends ​

Constructors ​

Constructor ​

new Experiments(): Experiments

Returns ​

Experiments

Inherited from ​

NetworkStructure.constructor

Properties ​

toggled ​

toggled: Experiment[] = []

Defined in: protocol/src/structure/Experiments.ts:17

Toggles: the active experiments followed by the always-on ones.


wereEverAlreadyToggled ​

wereEverAlreadyToggled: boolean = false

Defined in: protocol/src/structure/Experiments.ts:19

ExperimentsEverToggled: whether any experiment was ever switched on in this world.

Methods ​

deserialize() ​

deserialize(stream): void

Defined in: protocol/src/structure/Experiments.ts:30

Deserializes the network structure from a binary stream.

Parameters ​

stream ​

NetworkBinaryStream

The binary stream to deserialize from.

Returns ​

void

Overrides ​

NetworkStructure.deserialize


serialize() ​

serialize(stream): void

Defined in: protocol/src/structure/Experiments.ts:21

Serializes the network structure to a binary stream.

Parameters ​

stream ​

NetworkBinaryStream

The binary stream to serialize to.

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