Skip to content

API reference / @jsprismarine/protocol / UUID

Class: UUID ​

Defined in: protocol/src/structure/UUID.ts:10

An mce::UUID: Most Significant Bits then Least Significant Bits, each a uint64 little endian. Both halves are unsigned, so a half with its top bit set (half of all random UUIDs) must go through the unsigned writers; the signed ones throw a RangeError at 2^63. https://mojang.github.io/bedrock-protocol-docs/1.26.51/types/mce-uuid/

Extends ​

Constructors ​

Constructor ​

new UUID(most, least): UUID

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

Creates a UUID from its two halves.

Parameters ​

most ​

bigint

Most Significant Bits, in [0, 2^64).

least ​

bigint

Least Significant Bits, in [0, 2^64).

Returns ​

UUID

Overrides ​

NetworkStructure.constructor

Properties ​

least ​

least: bigint

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

Least Significant Bits, in [0, 2^64).


most ​

most: bigint

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

Most Significant Bits, in [0, 2^64).

Methods ​

deserialize() ​

deserialize(stream): void

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

Reads both halves as uint64 little endian.

Parameters ​

stream ​

NetworkBinaryStream

Returns ​

void

Overrides ​

NetworkStructure.deserialize


serialize() ​

serialize(stream): void

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

Writes both halves as uint64 little endian.

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