[API reference](https://jsprismarine.dev/api/index.md) / [@jsprismarine/prismarine](https://jsprismarine.dev/api/@jsprismarine/prismarine/index.md) / content/tags

# content/tags

## Interfaces

### ContentTags

Defined in: [packages/prismarine/src/content/tags.ts:31](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/content/tags.ts#L31)

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

> `readonly` **diagnostics**: readonly [`Diagnostic`](https://jsprismarine.dev/api/@jsprismarine/content/index.md#diagnostic)[]

Defined in: [packages/prismarine/src/content/tags.ts:35](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/content/tags.ts#L35)

Everything the merge reported, such as a tag reference that closes a cycle.

##### registries

> `readonly` **registries**: readonly `string`[]

Defined in: [packages/prismarine/src/content/tags.ts:33](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/content/tags.ts#L33)

The registries the stack tags, such as `block`, `item` and `worldgen/biome`.

##### size

> `readonly` **size**: `number`

Defined in: [packages/prismarine/src/content/tags.ts:37](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/content/tags.ts#L37)

How many tags the stack holds across every registry.

#### Methods

##### has()

> **has**(`registry`, `tag`): `boolean`

Defined in: [packages/prismarine/src/content/tags.ts:41](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/content/tags.ts#L41)

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](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/content/tags.ts#L45)

Whether an identifier is in a tag.

###### Parameters

###### registry

`string`

###### tag

`string`

###### identifier

`string`

###### Returns

`boolean`

##### members()

> **members**(`registry`, `tag`): readonly `string`[]

Defined in: [packages/prismarine/src/content/tags.ts:43](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/content/tags.ts#L43)

The members of one tag, in merge order, with `#` references expanded.

###### Parameters

###### registry

`string`

###### tag

`string`

###### Returns

readonly `string`[]

##### tags()

> **tags**(`registry`): readonly `string`[]

Defined in: [packages/prismarine/src/content/tags.ts:39](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/content/tags.ts#L39)

Every tag id of one registry, without a leading `#`.

###### Parameters

###### registry

`string`

###### Returns

readonly `string`[]

## Functions

### buildContentTags()

> **buildContentTags**(`definitions`, `hasMember?`): [`ContentTags`](#contenttags)

Defined in: [packages/prismarine/src/content/tags.ts:103](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/content/tags.ts#L103)

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`](https://jsprismarine.dev/api/@jsprismarine/packs/index.md#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

[`ContentTags`](#contenttags)

***

### contentResolver()

> **contentResolver**(`definitions`, `tags`): [`ReferenceResolver`](https://jsprismarine.dev/api/@jsprismarine/predicates/index.md#referenceresolver)

Defined in: [packages/prismarine/src/content/tags.ts:171](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/content/tags.ts#L171)

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.

#### Parameters

##### definitions

[`Definitions`](https://jsprismarine.dev/api/@jsprismarine/packs/index.md#definitions-1)

##### tags

[`ContentTags`](#contenttags)

#### Returns

[`ReferenceResolver`](https://jsprismarine.dev/api/@jsprismarine/predicates/index.md#referenceresolver)
