API reference / @jsprismarine/prismarine / content/tags
content/tags
Interfaces
ContentTags
Defined in: packages/prismarine/src/content/tags.ts:31
The merged tags of a pack stack, read by the registry they tag.
Members are identifiers rather than registry entries, because a Java tag names Java identifiers and the registries this server builds are keyed by Bedrock ones. Translating is @jsprismarine/mapping's job, and a caller that needs it does the lookup itself rather than having this table guess.
Properties
diagnostics
readonlydiagnostics: readonlyDiagnostic[]
Defined in: packages/prismarine/src/content/tags.ts:35
Everything the merge reported, such as a tag reference that closes a cycle.
registries
readonlyregistries: readonlystring[]
Defined in: packages/prismarine/src/content/tags.ts:33
The registries the stack tags, such as block, item and worldgen/biome.
size
readonlysize:number
Defined in: packages/prismarine/src/content/tags.ts:37
How many tags the stack holds across every registry.
Methods
has()
has(
registry,tag):boolean
Defined in: packages/prismarine/src/content/tags.ts:41
Whether the stack defines a tag at all, which is different from its being empty.
Parameters
registry
string
tag
string
Returns
boolean
includes()
includes(
registry,tag,identifier):boolean
Defined in: packages/prismarine/src/content/tags.ts:45
Whether an identifier is in a tag.
Parameters
registry
string
tag
string
identifier
string
Returns
boolean
members()
members(
registry,tag): readonlystring[]
Defined in: packages/prismarine/src/content/tags.ts:43
The members of one tag, in merge order, with # references expanded.
Parameters
registry
string
tag
string
Returns
readonly string[]
tags()
tags(
registry): readonlystring[]
Defined in: packages/prismarine/src/content/tags.ts:39
Every tag id of one registry, without a leading #.
Parameters
registry
string
Returns
readonly string[]
Functions
buildContentTags()
buildContentTags(
definitions,hasMember?):ContentTags
Defined in: packages/prismarine/src/content/tags.ts:103
Merges the stack's tag files, one Tags per tagged registry.
The identifier registry each Tags resolves against is built from the identifiers the files themselves name, so a member is never reported missing just because this server has no entry for it yet. A member that really is absent from a later content build shows up through its holder instead.
Parameters
definitions
ReadonlyMap<string, Definition>
The tags map @jsprismarine/packs produced.
hasMember?
(registry, identifier) => boolean
Whether the tagged registry contains a member. Missing optional members are dropped, while missing required members are reported by the tag resolver. Defaults to accepting every plain identifier for callers that build tags without a registry census.
Returns
contentResolver()
contentResolver(
definitions,tags):ReferenceResolver
Defined in: packages/prismarine/src/content/tags.ts:171
The reference resolver the Java grammars parse against.
Elements come straight out of the loaded registries, and tags out of the merged ContentTags rather than out of the raw files: the merge has already applied Java Edition's cross-pack rule, so a tag two packs both add to expands to both halves here and to one of them through the files.