Skip to main content

Class: Entities

An interceptor for the network layer. When registered to a network instance, the network instance will run through all network packets through the interceptor, and also allowing the interceptor to send packets to the server.

Hierarchy​

  • Group

    ↳ Entities

Implements​

Constructors​

constructor​

• new Entities(options?): Entities

Parameters​

NameType
optionsPartial<EntitiesOptions>

Returns​

Entities

Overrides​

Group.constructor

Properties​

map​

• map: Map<string, Entity<any>>


options​

• options: EntitiesOptions


packets​

• packets: MessageProtocol[] = []

Requests for the server (see setOnRequestMetadata).

Implementation of​

NetIntercept.packets


types​

• types: Map<string, (id: string) => Entity<any> | (id: string) => Entity<any>>

Methods​

appliedTick​

▸ appliedTick(id): number

Parameters​

NameType
idstring

Returns​

number


getEntityById​

▸ getEntityById(id): Entity<any>

Get an entity instance by its ID.

Parameters​

NameTypeDescription
idstringThe ID of the entity to get.

Returns​

Entity<any>

The entity object with the given ID.


setClass​

▸ setClass(type, entity): void

Parameters​

NameType
typestring
entity(id: string) => Entity<any> | (id: string) => Entity<any>

Returns​

void


setOnRequestMetadata​

▸ setOnRequestMetadata(isWanted): void

Receive the world's on-request entity metadata keys, or stop. A world keeps metadata only a debug view reads (and that changes every tick) out of every client's updates unless asked; ask while such a view is shown. Kept across reconnects: a fresh session is asked again.

Parameters​

NameType
isWantedboolean

Returns​

void


snapAllToTarget​

▸ snapAllToTarget(): void

Returns​

void


update​

▸ update(cameraPos?, renderDistance?): void

Parameters​

NameType
cameraPos?Vector3
renderDistance?number

Returns​

void