Skip to content

API reference / @jsprismarine/entities / EntityTypes

Class: EntityTypes ​

Defined in: entities/src/entityTypes.ts:42

The parsed definitions, the resolved types and the registry they live in.

Constructors ​

Constructor ​

new EntityTypes(options?): EntityTypes

Defined in: entities/src/entityTypes.ts:53

Parameters ​

options? ​

EntityTypesOptions = {}

Returns ​

EntityTypes

Properties ​

components ​

readonly components: EntityComponentRegistry

Defined in: entities/src/entityTypes.ts:47

The components the types resolve against.


registry ​

readonly registry: Registry<EntityType>

Defined in: entities/src/entityTypes.ts:44

The resolved types, keyed by identifier with a dense id per entry.

Methods ​

load() ​

load(files): readonly Diagnostic[]

Defined in: entities/src/entityTypes.ts:63

Parses and resolves entity files, replacing whatever the table held.

Parameters ​

files ​

Iterable<EntityFile>

Returns ​

readonly Diagnostic[]

The parse and resolve reports, concatenated.


spawn() ​

spawn(identifier, options?): EntityInstance

Defined in: entities/src/entityTypes.ts:93

Makes one entity and runs its spawn event.

The identifier accepts the identifier<event> form vanilla writes in transformation.into and permute_type.entity_type, and the named event replaces the built-in spawn event rather than adding to it.

Parameters ​

identifier ​

string

options? ​

EntityInstanceOptions & object = {}

Returns ​

EntityInstance

Throws ​

When no loaded definition carries the identifier.