Skip to content

API reference / @jsprismarine/protocol / BlockPos

Class: BlockPos ​

Defined in: protocol/src/structure/BlockPos.ts:8

Represents the network structure of a block position. https://mojang.github.io/bedrock-protocol-docs/1.26.51/types/block-pos/

Extends ​

Constructors ​

Constructor ​

new BlockPos(x, y, z): BlockPos

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

Creates a new instance of Vec3.

Parameters ​

x ​

number

The x-coordinate of the vector.

y ​

number

The y-coordinate of the vector.

z ​

number

The z-coordinate of the vector.

Returns ​

BlockPos

Inherited from ​

Vec3.constructor

Properties ​

x ​

x: number

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

The x-coordinate of the vector.

Inherited from ​

Vec3.x


y ​

y: number

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

The y-coordinate of the vector.

Inherited from ​

Vec3.y


z ​

z: number

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

The z-coordinate of the vector.

Inherited from ​

Vec3.z

Methods ​

deserialize() ​

deserialize(stream): void

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

Deserializes the block position from a binary stream.

Parameters ​

stream ​

BinaryStream

The binary stream to read from.

Returns ​

void

Overrides ​

Vec3.deserialize


serialize() ​

serialize(stream): void

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

Serializes the block position to a binary stream.

Parameters ​

stream ​

BinaryStream

The binary stream to write to.

Returns ​

void

Overrides ​

Vec3.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 ​

Vec3.deserialize