API reference / @jsprismarine/prismarine / EntityFactsLookup
Class: EntityFactsLookup
Defined in: prismarine/src/entity/data/facts.ts:139
Reads the facts of every entity type in a registry, once.
Deliberately a lookup over a registry rather than a free function over a type: the facts are cached, and a content reload replaces the whole registry and so the whole lookup, which is the rule the content root sets for anything keyed by a positional id.
What a type declares in its base components, which is what a caller holding no entity can know. Wrap the answer in liveFactsOf wherever there is an entity to read instead.
Constructors
Constructor
new EntityFactsLookup(
registry):EntityFactsLookup
Defined in: prismarine/src/entity/data/facts.ts:142
Parameters
registry
Returns
EntityFactsLookup
Methods
get()
get(
identifier):EntityFacts|undefined
Defined in: prismarine/src/entity/data/facts.ts:154
The facts of one type, or undefined when the content carries no such entity. Nothing is guessed: a caller that gets undefined knows the pack stack never declared the entity.
Parameters
identifier
string
Returns
EntityFacts | undefined
identifiers()
identifiers(): readonly
string[]
Defined in: prismarine/src/entity/data/facts.ts:145
The identifiers the registry carries, in registry order.
Returns
readonly string[]