Skip to content

API reference / @jsprismarine/protocol / AttributeLayerData

Class: AttributeLayerData ​

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

One AttributeLayerData: the full definition of an environment attribute layer, as the UpdateAttributeLayersData alternative of ClientboundAttributeLayerSyncPacket lists them.

Protocol 2193 wire order: Name (string), NoiseName as an optional string (a presence byte, then the string only when set), Dimension as a ZigZag varint32, Settings as an AttributeLayerSettings, then Attributes as a varuint32 count followed by one EnvironmentAttributeData each. Protocol 2207 drops NoiseName. https://mojang.github.io/bedrock-protocol-docs/1.26.51/types/attribute-layer-data/

Extends ​

Constructors ​

Constructor ​

new AttributeLayerData(name?, noiseName?, dimension?, settings?, attributes?): AttributeLayerData

Defined in: protocol/src/structure/AttributeLayerData.ts:18

Parameters ​

name? ​

string = ''

Name of the layer, at most 128 characters.

noiseName? ​

string

NoiseName, the noise the layer's transitions sample. Unset when the layer uses none.

dimension? ​

number = 0

Dimension the layer applies to: 0 for the Overworld, 1 for the Nether, 2 for the End, custom ones from 1000.

settings? ​

AttributeLayerSettings = ...

Settings of the layer.

attributes? ​

EnvironmentAttributeData[] = []

Attributes the layer defines.

Returns ​

AttributeLayerData

Overrides ​

NetworkStructure.constructor

Properties ​

attributes ​

attributes: EnvironmentAttributeData[] = []

Defined in: protocol/src/structure/AttributeLayerData.ts:28

Attributes the layer defines.


dimension ​

dimension: number = 0

Defined in: protocol/src/structure/AttributeLayerData.ts:24

Dimension the layer applies to: 0 for the Overworld, 1 for the Nether, 2 for the End, custom ones from 1000.


name ​

name: string = ''

Defined in: protocol/src/structure/AttributeLayerData.ts:20

Name of the layer, at most 128 characters.


noiseName? ​

optional noiseName?: string

Defined in: protocol/src/structure/AttributeLayerData.ts:22

NoiseName, the noise the layer's transitions sample. Unset when the layer uses none.


settings ​

settings: AttributeLayerSettings

Defined in: protocol/src/structure/AttributeLayerData.ts:26

Settings of the layer.

Methods ​

deserialize() ​

deserialize(stream): void

Defined in: protocol/src/structure/AttributeLayerData.ts:45

Reads every field in the order the docs list them.

Parameters ​

stream ​

NetworkBinaryStream

Returns ​

void

Overrides ​

NetworkStructure.deserialize


serialize() ​

serialize(stream): void

Defined in: protocol/src/structure/AttributeLayerData.ts:34

Writes every field in the order the docs list them.

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