Skip to content

@pumpkin-plugins/distant-horizons-support-pumpkin API / protocol/bytes / Writer

Class: Writer ​

Defined in: packages/distant-horizons-support-pumpkin/src/protocol/bytes.ts:11

Writes the big-endian integers and UTF-8 strings used by DH.

Methods ​

blob() ​

blob(value): this

Defined in: packages/distant-horizons-support-pumpkin/src/protocol/bytes.ts:56

Appends bytes prefixed by a 32-bit length.

Parameters ​

value ​

Uint8Array

Returns ​

this


bool() ​

bool(value): this

Defined in: packages/distant-horizons-support-pumpkin/src/protocol/bytes.ts:22

Appends a boolean.

Parameters ​

value ​

boolean

Returns ​

this


byte() ​

byte(value): this

Defined in: packages/distant-horizons-support-pumpkin/src/protocol/bytes.ts:16

Appends one byte.

Parameters ​

value ​

number

Returns ​

this


bytes() ​

bytes(value): this

Defined in: packages/distant-horizons-support-pumpkin/src/protocol/bytes.ts:49

Appends bytes without a length prefix.

Parameters ​

value ​

Uint8Array

Returns ​

this


finish() ​

finish(): Uint8Array

Defined in: packages/distant-horizons-support-pumpkin/src/protocol/bytes.ts:87

Returns a copy of the encoded bytes.

Returns ​

Uint8Array


int() ​

int(value): this

Defined in: packages/distant-horizons-support-pumpkin/src/protocol/bytes.ts:33

Appends a 32-bit integer.

Parameters ​

value ​

number

Returns ​

this


short() ​

short(value): this

Defined in: packages/distant-horizons-support-pumpkin/src/protocol/bytes.ts:26

Appends a 16-bit integer.

Parameters ​

value ​

number

Returns ​

this


string() ​

string(value): this

Defined in: packages/distant-horizons-support-pumpkin/src/protocol/bytes.ts:60

Appends UTF-8 prefixed by its byte length, matching the DH protocol.

Parameters ​

value ​

string

Returns ​

this


timestamp() ​

timestamp(value): this

Defined in: packages/distant-horizons-support-pumpkin/src/protocol/bytes.ts:44

Appends a nonnegative, safe 64-bit timestamp.

Parameters ​

value ​

number

Returns ​

this


words() ​

words(high, low): this

Defined in: packages/distant-horizons-support-pumpkin/src/protocol/bytes.ts:40

Appends an exact 64-bit bit pattern as two 32-bit words.

Parameters ​

high ​

number

low ​

number

Returns ​

this

pumpkin-plugins documentation