Skip to content

API reference / @jsprismarine/protocol / EnvironmentAttributeData

Class: EnvironmentAttributeData ​

Defined in: protocol/src/structure/EnvironmentAttributeData.ts:162

One EnvironmentAttributeData: a named environment attribute of an attribute layer, with the transition it may be in the middle of. ClientboundAttributeLayerSyncPacket carries a list of them inside each AttributeLayerData and in UpdateEnvironmentAttributesData.

Protocol 2193 wire order: AttributeName (string), FromAttribute as an optional attribute value (a presence byte, then the value only when set), Attribute as an attribute value, ToAttribute as another optional one, CurrentTransitionTicks and TotalTransitionTicks as little-endian uint32, Easing as an easing_function string (EasingFunction, shared with the camera instructions; the schema does not mark the enum Enum-as-Value), LocalTransitionTicks as a little-endian uint32, NoiseTransition as one byte, then NoiseAlignment as a NoiseAlignment.

An attribute value is a Cereal tagged variant: a varuint32 selector (the AttributeDataType value) followed by the alternative's fields. BoolAttributeData is value as one byte then operation as a string. FloatAttributeData is value as a little-endian float, operation as a string, then constraintMin and constraintMax as optional little-endian floats (a presence byte each). ColorAttributeData is value as four bytes then operation as a string. The operation strings are the docs' member names (OVERRIDE, ALPHA_BLEND, ...). The schema gives operation a default rather than making it optional, so it is always on the wire.

gophertunnel master (protocol 2193) writes operation as an optional little-endian int32 instead of a string; the docs and the way gophertunnel itself writes every other enum the schema leaves without Enum-as-Value (command permission levels, animate swing sources) say string. No capture settles it, since the game marks the packet "Currently disabled". Protocol 2207 restructures this type around a Payload variant. https://mojang.github.io/bedrock-protocol-docs/1.26.51/types/environment-attribute-data/

Extends ​

Implements ​

Constructors ​

Constructor ​

new EnvironmentAttributeData(fields?): EnvironmentAttributeData

Defined in: protocol/src/structure/EnvironmentAttributeData.ts:178

Creates an environment attribute.

Parameters ​

fields? ​

EnvironmentAttributeFields = ...

Every field in wire order. Defaults to an unnamed, non-transitioning boolean false.

Returns ​

EnvironmentAttributeData

Overrides ​

NetworkStructure.constructor

Properties ​

attribute ​

attribute: AttributeValue

Defined in: protocol/src/structure/EnvironmentAttributeData.ts:165

Attribute, the value in effect now.

Implementation of ​

EnvironmentAttributeFields.attribute


attributeName ​

attributeName: string

Defined in: protocol/src/structure/EnvironmentAttributeData.ts:163

AttributeName, at most 128 characters.

Implementation of ​

EnvironmentAttributeFields.attributeName


currentTransitionTicks ​

currentTransitionTicks: number

Defined in: protocol/src/structure/EnvironmentAttributeData.ts:167

CurrentTransitionTicks elapsed since the transition started.

Implementation of ​

EnvironmentAttributeFields.currentTransitionTicks


easing ​

easing: "linear" | "spring" | "in_quad" | "out_quad" | "in_out_quad" | "in_cubic" | "out_cubic" | "in_out_cubic" | "in_quart" | "out_quart" | "in_out_quart" | "in_quint" | "out_quint" | "in_out_quint" | "in_sine" | "out_sine" | "in_out_sine" | "in_expo" | "out_expo" | "in_out_expo" | "in_circ" | "out_circ" | "in_out_circ" | "in_bounce" | "out_bounce" | "in_out_bounce" | "in_back" | "out_back" | "in_out_back" | "in_elastic" | "out_elastic" | "in_out_elastic"

Defined in: protocol/src/structure/EnvironmentAttributeData.ts:169

Easing curve the transition follows, an easing_function name such as "in_out_quad".

Implementation of ​

EnvironmentAttributeFields.easing


fromAttribute? ​

optional fromAttribute?: AttributeValue

Defined in: protocol/src/structure/EnvironmentAttributeData.ts:164

FromAttribute, the value a running transition started from. Unset when nothing is transitioning.

Implementation of ​

EnvironmentAttributeFields.fromAttribute


localTransitionTicks ​

localTransitionTicks: number

Defined in: protocol/src/structure/EnvironmentAttributeData.ts:170

LocalTransitionTicks elapsed in the noise-local part of the transition.

Implementation of ​

EnvironmentAttributeFields.localTransitionTicks


noiseAlignment ​

noiseAlignment: NoiseAlignment

Defined in: protocol/src/structure/EnvironmentAttributeData.ts:172

NoiseAlignment of that noise.

Implementation of ​

EnvironmentAttributeFields.noiseAlignment


noiseTransition ​

noiseTransition: boolean

Defined in: protocol/src/structure/EnvironmentAttributeData.ts:171

NoiseTransition: whether the layer's noise drives the transition.

Implementation of ​

EnvironmentAttributeFields.noiseTransition


toAttribute? ​

optional toAttribute?: AttributeValue

Defined in: protocol/src/structure/EnvironmentAttributeData.ts:166

ToAttribute, the value a running transition ends at. Unset when nothing is transitioning.

Implementation of ​

EnvironmentAttributeFields.toAttribute


totalTransitionTicks ​

totalTransitionTicks: number

Defined in: protocol/src/structure/EnvironmentAttributeData.ts:168

TotalTransitionTicks the transition lasts.

Implementation of ​

EnvironmentAttributeFields.totalTransitionTicks

Methods ​

deserialize() ​

deserialize(stream): void

Defined in: protocol/src/structure/EnvironmentAttributeData.ts:282

Reads every field in the order the docs list them.

Parameters ​

stream ​

NetworkBinaryStream

Returns ​

void

Throws ​

when a selector or an enum name on the wire matches no known member.

Overrides ​

NetworkStructure.deserialize


serialize() ​

serialize(stream): void

Defined in: protocol/src/structure/EnvironmentAttributeData.ts:265

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