Skip to content

API reference / @jsprismarine/prismarine / entity/data/live / EntityRuntimes

Class: EntityRuntimes ​

Defined in: packages/prismarine/src/entity/data/live.ts:1631

The data-driven entity runtimes of a server, one per world: each dimension of each level.

Held by the server rather than by either end: the content world adapter opens one while it assembles a world's groups, and that World looks it up by its dimension and level to tick it. Keyed by both, as worldKeyOf says why.

Constructors ​

Constructor ​

new EntityRuntimes(): EntityRuntimes

Returns ​

EntityRuntimes

Properties ​

players ​

readonly players: StorePlayers

Defined in: packages/prismarine/src/entity/data/live.ts:1635

The server's store players, which every world's actors read.

Methods ​

at() ​

at(dimension, level?): LiveEntityRuntime | undefined

Defined in: packages/prismarine/src/entity/data/live.ts:1658

The runtime of one world, or undefined when nothing opened one.

Parameters ​

dimension ​

string

The namespaced dimension identifier.

level? ​

string

The level's name, or undefined for the default level.

Returns ​

LiveEntityRuntime | undefined


close() ​

close(dimension, level?): void

Defined in: packages/prismarine/src/entity/data/live.ts:1676

Forgets one world's runtime, which is what closing it does.

Parameters ​

dimension ​

string

The namespaced dimension identifier.

level? ​

string

The level's name, or undefined for the default level.

Returns ​

void


closeAll() ​

closeAll(): void

Defined in: packages/prismarine/src/entity/data/live.ts:1683

Forgets every runtime, which is what a server shutdown does once the worlds are down.

Returns ​

void


goalWorldFor() ​

goalWorldFor(instance): GoalWorld | undefined

Defined in: packages/prismarine/src/entity/data/live.ts:1663

Resolves the goal world from whichever world owns this instance.

Parameters ​

instance ​

EntityInstance

Returns ​

GoalWorld | undefined


open() ​

open(options): LiveEntityRuntime

Defined in: packages/prismarine/src/entity/data/live.ts:1643

The runtime for one world, built on first ask and kept.

Parameters ​

options ​

LiveEntityOptions

Returns ​

LiveEntityRuntime

The existing runtime when the world already has one, so an adapter rebuilt for the same world drives the same entities.