API reference / @jsprismarine/prismarine / command/vanillaCommands
command/vanillaCommands
Variables
UNWIRED_COMMANDS
constUNWIRED_COMMANDS:Readonly<Record<string,string>>
Defined in: packages/prismarine/src/command/vanillaCommands.ts:32
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<CommandSource>
Defined in: packages/prismarine/src/command/vanillaCommands.ts:107
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?
What the pack stack holds, from 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<CommandSource>
The registry, with UNWIRED_COMMANDS left out.
contentRegistryIds()
contentRegistryIds(
content):ContentRegistryIds
Defined in: packages/prismarine/src/command/vanillaCommands.ts:83
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, 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
The server's content build.
Returns
One id list per validated registry.
isSummonable()
isSummonable(
type):boolean
Defined in: packages/prismarine/src/command/vanillaCommands.ts:48
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 | 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
The entity identifiers /summon offers and accepts: every declared type whose definition is summonable.
Parameters
registry
The content build's entity registry.
Returns
string[]