Skip to main content

Class: Chunk

protocol.Chunk

Represents a Chunk.

Implements

Constructors

constructor

new Chunk(properties?): Chunk

Constructs a new Chunk.

Parameters

NameTypeDescription
properties?IChunkProperties to set

Returns

Chunk

Properties

id

id: string

Chunk id.

Implementation of

IChunk.id


lights

lights: number[]

Chunk lights.

Implementation of

IChunk.lights


meshes

meshes: IMesh[]

Chunk meshes.

Implementation of

IChunk.meshes


voxels

voxels: number[]

Chunk voxels.

Implementation of

IChunk.voxels


x

x: number

Chunk x.

Implementation of

IChunk.x


z

z: number

Chunk z.

Implementation of

IChunk.z

Methods

create

create(properties?): Chunk

Creates a new Chunk instance using the specified properties.

Parameters

NameTypeDescription
properties?IChunkProperties to set

Returns

Chunk

Chunk instance


decode

decode(reader, length?): Chunk

Decodes a Chunk message from the specified reader or buffer.

Parameters

NameTypeDescription
readerReader | Uint8ArrayReader or buffer to decode from
length?numberMessage length if known beforehand

Returns

Chunk

Chunk

Throws

If the payload is not a reader or valid buffer

Throws

If required fields are missing


decodeDelimited

decodeDelimited(reader): Chunk

Decodes a Chunk message from the specified reader or buffer, length delimited.

Parameters

NameTypeDescription
readerReader | Uint8ArrayReader or buffer to decode from

Returns

Chunk

Chunk

Throws

If the payload is not a reader or valid buffer

Throws

If required fields are missing


encode

encode(message, writer?): Writer

Encodes the specified Chunk message. Does not implicitly verify messages.

Parameters

NameTypeDescription
messageIChunkChunk message or plain object to encode
writer?WriterWriter to encode to

Returns

Writer

Writer


encodeDelimited

encodeDelimited(message, writer?): Writer

Encodes the specified Chunk message, length delimited. Does not implicitly verify messages.

Parameters

NameTypeDescription
messageIChunkChunk message or plain object to encode
writer?WriterWriter to encode to

Returns

Writer

Writer


fromObject

fromObject(object): Chunk

Creates a Chunk message from a plain object. Also converts values to their respective internal types.

Parameters

NameTypeDescription
objectObjectPlain object

Returns

Chunk

Chunk


getTypeUrl

getTypeUrl(typeUrlPrefix?): string

Gets the default type url for Chunk

Parameters

NameTypeDescription
typeUrlPrefix?stringyour custom typeUrlPrefix(default "type.googleapis.com")

Returns

string

The default type url


toJSON

toJSON(): Object

Converts this Chunk to JSON.

Returns

Object

JSON object


toObject

toObject(message, options?): Object

Creates a plain object from a Chunk message. Also converts values to other types if specified.

Parameters

NameTypeDescription
messageChunkChunk
options?IConversionOptionsConversion options

Returns

Object

Plain object


verify

verify(message): string

Verifies a Chunk message.

Parameters

NameTypeDescription
messageObjectPlain object to verify

Returns

string

null if valid, otherwise the reason why it is not