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:45

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:19

Appends a boolean.

Parameters ​

value ​

boolean

Returns ​

this


byte() ​

byte(value): this

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

Appends one byte.

Parameters ​

value ​

number

Returns ​

this


bytes() ​

bytes(value): this

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

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:71

Returns the encoded bytes.

Returns ​

Uint8Array


int() ​

int(value): this

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

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:23

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:49

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:35

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:31

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

Parameters ​

high ​

number

low ​

number

Returns ​

this

Pumpkin Plugins documentation