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

# command/vanillaCommands

## Variables

### UNWIRED\_COMMANDS

> `const` **UNWIRED\_COMMANDS**: `Readonly`\<`Record`\<`string`, `string`\>\>

Defined in: [packages/prismarine/src/command/vanillaCommands.ts:32](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/command/vanillaCommands.ts#L32)

The commands this server does not advertise, and what each one would need.

Keyed by command name so a reader can answer "why is this command unavailable"
from one place, and so the gap closes by deleting a row rather than by
finding the filter.

## Functions

### buildVanillaCommands()

> **buildVanillaCommands**(`content?`, `canUse?`): [`CommandRegistry`](https://jsprismarine.dev/api/@jsprismarine/commands/classes/CommandRegistry.md)\<[`CommandSource`](https://jsprismarine.dev/api/@jsprismarine/commands/index.md#commandsource)\>

Defined in: [packages/prismarine/src/command/vanillaCommands.ts:107](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/command/vanillaCommands.ts#L107)

Builds the registry this server dispatches and advertises.

The host is not a parameter: a command reaches it through the
`CommandSource` it runs with, which is built per dispatch, so one registry
serves every sender.

#### Parameters

##### content?

[`ContentRegistryIds`](https://jsprismarine.dev/api/@jsprismarine/commands/index.md#contentregistryids)

What the pack stack holds, from
[contentRegistryIds](#contentregistryids). Its lists are what the registry arguments
accept on top of Mojang's. Left out before the content build has run, which
is the registry `CommandManager`'s constructor holds until `enable`
replaces it.

##### canUse?

(`name`, `source`) => `boolean`

#### Returns

[`CommandRegistry`](https://jsprismarine.dev/api/@jsprismarine/commands/classes/CommandRegistry.md)\<[`CommandSource`](https://jsprismarine.dev/api/@jsprismarine/commands/index.md#commandsource)\>

The registry, with
[UNWIRED\_COMMANDS](#unwired-commands) left out.

***

### contentRegistryIds()

> **contentRegistryIds**(`content`): [`ContentRegistryIds`](https://jsprismarine.dev/api/@jsprismarine/commands/index.md#contentregistryids)

Defined in: [packages/prismarine/src/command/vanillaCommands.ts:83](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/command/vanillaCommands.ts#L83)

The four registries whose contents a command argument validates against.

Mojang's published command enums are frozen at the version the table was
generated from, so validating against them alone refuses a pack's own
`mypack:dragon` at parse for an entity this server can spawn. These four
are the registries a host verb resolves an id against and a pack can
extend, so each is offered alongside Mojang's list rather than instead of
it. The entity list holds only [summonableEntityTypes](#summonableentitytypes), because
`/summon` and `execute summon` are the only arguments that read it.

The registries left out fail that test for their own reasons.
`minecraft:mob_effect` uses Mojang's published list because the host keeps
no custom effect registry. `minecraft:attribute`,
`minecraft:particle_type` and `minecraft:worldgen/biome` are not validated
by anybody: Bedrock publishes no enum for them, so they already reach a
command body as an unchecked string.

A scoreboard criterion's statistics come from Java's registries instead
(JAVA\_STATISTICS), since a criterion names Java's ids.

#### Parameters

##### content

[`ServerContent`](https://jsprismarine.dev/api/@jsprismarine/prismarine/content/ServerContent/index.md#servercontent)

The server's content build.

#### Returns

[`ContentRegistryIds`](https://jsprismarine.dev/api/@jsprismarine/commands/index.md#contentregistryids)

One id list per validated registry.

***

### isSummonable()

> **isSummonable**(`type`): `boolean`

Defined in: [packages/prismarine/src/command/vanillaCommands.ts:48](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/command/vanillaCommands.ts#L48)

Whether `/summon` may create an entity of this type.

The answer is the definition's `is_summonable` flag. Mojang's own
`EntityType` command enum holds exactly the vanilla types the pack marks
summonable, so a projectile, the player and an engine entity such as
`jsprismarine:inert_actor` are refused, as Bedrock Dedicated Server refuses
them.

#### Parameters

##### type

[`EntityType`](https://jsprismarine.dev/api/@jsprismarine/entities/index.md#entitytype) \| `undefined`

The entity type, or undefined when the pack does not declare it.

#### Returns

`boolean`

***

### summonableEntityTypes()

> **summonableEntityTypes**(`registry`): `string`[]

Defined in: [packages/prismarine/src/command/vanillaCommands.ts:56](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/command/vanillaCommands.ts#L56)

The entity identifiers `/summon` offers and accepts: every declared type
whose definition is summonable.

#### Parameters

##### registry

[`Registry`](https://jsprismarine.dev/api/@jsprismarine/content/classes/Registry.md)\<[`EntityType`](https://jsprismarine.dev/api/@jsprismarine/entities/index.md#entitytype)\>

The content build's entity registry.

#### Returns

`string`[]
