Skip to content

API reference / @jsprismarine/protocol / SubChunkPosOffset

Class: SubChunkPosOffset ​

Defined in: protocol/src/structure/SubChunkPosOffset.ts:13

The offset of one sub chunk from a batch's center, counted in sub chunks: Subchunk Offset X, Subchunk Offset Y, then Subchunk Offset Z, each a signed byte.

A byte per axis limits a batch to sub chunks within 127 of the center; anything farther needs a new batch with a new center. https://mojang.github.io/bedrock-protocol-docs/1.26.51/types/sub-chunk-pos-offset/

Extends ​

Constructors ​

Constructor ​

new SubChunkPosOffset(x?, y?, z?): SubChunkPosOffset

Defined in: protocol/src/structure/SubChunkPosOffset.ts:14

Parameters ​

x? ​

number = 0

y? ​

number = 0

z? ​

number = 0

Returns ​

SubChunkPosOffset

Overrides ​

NetworkStructure.constructor

Properties ​

x ​

x: number = 0

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


y ​

y: number = 0

Defined in: protocol/src/structure/SubChunkPosOffset.ts:16


z ​

z: number = 0

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

Methods ​

deserialize() ​

deserialize(stream): void

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

Reads X, Y, then Z, each a signed byte.

Parameters ​

stream ​

NetworkBinaryStream

Returns ​

void

Overrides ​

NetworkStructure.deserialize


serialize() ​

serialize(stream): void

Defined in: protocol/src/structure/SubChunkPosOffset.ts:23

Writes X, Y, then Z, each a signed byte.

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