API reference / @jsprismarine/commands
@jsprismarine/commands
The command layer: Mojang's published Bedrock command table, a Java-shaped command tree the Brigadier port dispatches, the flattener that turns that tree into an AvailableCommandsPacket payload, and the target selector grammars for both editions.
The data source
Mojang publishes Bedrock's whole command set as machine-readable data. The table under src/tables/bedrockCommands.json is generated from metadata/command_modules/mojang-commands.json in Mojang/bedrock-samples, pinned by packages/bedrock-data/sources.json to tag v1.26.50.4, commit 46ba6ea985fb5a92d79a9419198f10dda14c199d.
The generator measures what it emits, and src/bedrockTable.test.ts asserts the counts:
| Count | |
|---|---|
| Commands | 84 |
| Overloads | 279 |
| Parameters | 1186 |
| Command enums | 236 |
| Enum values | 14281 |
| Basic parameter types | 26 |
| Soft enums | 4 |
Nothing in the table is hand-written. A game version bump is a re-fetch and a re-run:
pnpm --filter @jsprismarine/bedrock-data run fetch:sources
pnpm --filter @jsprismarine/commands run generate:bedrock-commandsThe generator refuses to emit when the source is missing, when two command enums collide on the upper-case name a parameter refers to them by, or when a command, overload or enum list comes back empty. The fetched metadata is an extracted game file, so it is parsed and validated, never executed.
Java command syntax
The Java command tree comes from Mojang's reports/commands.json for Java Edition 26.3, republished in mcmeta's 26.3 summary. The pinned commit is d96c75fec200c4580dd75e033a76341521165461, and the report SHA-256 is 9e14a839e32dbcaae044aeb987f1d9c4a4a3c8f7f3a8a3a87dc055e61fa8a84a.
src/tables/javaCommands.json holds that report. registerVanillaCommands() adds its signatures for the 46 shared commands and the five Java-only commands this package implements, while keeping the existing Bedrock spellings. Regenerate the table with:
pnpm --filter @jsprismarine/commands run generate:java-commandsThe report defines accepted syntax and argument parsers. Existing command handlers run forms they support; a Java form without a matching host implementation returns an explicit error.
Read the table through src/bedrockTable.ts, which casts the parsed JSON once and exposes bedrockCommandTable, bedrockCommand, bedrockCommandEnum, isBedrockSoftEnum and isBedrockBasicType.
The enums are also what a Java registry argument completes from. resourceArgument('minecraft:item') sends Mojang's own Item enum, all 3411 values of it, rather than an unvalidated string, and the same holds for minecraft:block, minecraft:entity_type, minecraft:mob_effect, minecraft:enchantment, minecraft:damage_type and minecraft:biome. Mojang's lists are unnamespaced where Java's commands take a full id, so both spellings parse and a command body is always handed the id. A registry Bedrock publishes no enum for still degrades to a string.
Mojang's list is frozen at the version the table was generated from, which makes it the wrong thing to validate against on its own once content packs are loaded: /summon mypack:dragon would be refused at parse for an entity the host can spawn. A caller that can enumerate its own registries passes them as CommandRegistryOptions.content, and the two lists are accepted together. Added rather than substituted, for two reasons: a host whose build omits a vanilla id should not make that id unspellable, and Mojang's list is what a Bedrock client completes from. The client is offered the union, so a pack's own ids autocomplete too.
ContentRegistryIds names the four registries this applies to: entity types, blocks, items and enchantments. They are the registries a host verb resolves an id against and a pack can extend. minecraft:damage_type and minecraft:mob_effect stay pinned to Mojang's enum because no host here keeps a registry for either, and minecraft:attribute, minecraft:particle_type and minecraft:worldgen/biome are unvalidated already, Bedrock publishing no enum for any of them.
The command tree, and what flattening it costs
CommandRegistry holds the Brigadier port's own tree, unchanged: literals, arguments, redirects and forks, dispatched by CommandDispatcher.execute. Java semantics run server-side. What the registry adds is the per-command data AvailableCommandsPacket carries and Brigadier has no place for, a description, an alias list, a permission level and a flags word. An alias is registered as a literal that redirects to the real root and shares its executor, so /tp and /teleport parse the same arguments and run the same code.
buildAvailableCommands(registry, options) returns the packet's eight fields as values plus the flattener's report. Pass source to filter by CommandNode.canUse the way Java does, so a player is only told about the commands they may run.
Bedrock's tree is a flat overload list per command with no redirects, so Java's graph becomes a cartesian expansion. Six shapes do not survive it unchanged, and each produces a note instead of a silent drop:
| Shape | What the client gets | Note |
|---|---|---|
| A redirect back onto the current path, which is a cycle | One trailing chained-subcommand parameter, and the overload marked isChaining | redirect-cycle |
| A redirect to the dispatcher root | One CODEBUILDERARGS parameter, which the client will not autocomplete | redirect-to-root |
| An argument whose type Bedrock has no parameter type for | An ID string, unvalidated | no-bedrock-type |
| An argument type from outside this package | An ID string | untyped-argument |
| A node that is its own child | Nothing; the branch is cut | self-child |
| An expansion past the overload cap | Nothing past the cap | overload-limit |
A fork flattens normally and is noted anyway. A Bedrock client can be shown /execute as @e run say hi; what it cannot do is run the fan-out, which happens in CommandDispatcher.execute. The note tells a caller that the overload it is about to send has semantics the client does not share. Nothing else about Java's fork reaches the wire, which is why execute store result score ... cannot be shown at all: no chained subcommand, no parameter type and no redirect express it.
Sibling literals whose continuations are identical collapse into one enum, which is how if and unless become OPTION_IF_UNLESS. That is Mojang's own encoding: in mojang-commands.json every /execute subcommand keyword is a one-value hard enum (OPTION_AS, OPTION_AT) and the tail is EXECUTECHAINEDOPTION_0. Flattening a Java /execute built with redirects produces the same shape.
Two details of the packet are worth stating because Mojang's schema does not settle them:
Chained Subcommand Dataentries carry value pairs Mojang namesfirstandsecondand defines neither. The only datum a chained table has per entry is the keyword, so this package writes its index intoChained Subcommand Valuesin both members.CommandData.Flagsis auint16Mojang documents as "the command flags" without enumerating the bits, so the default here is 0, as it is everywhere else in this repository.
The parameter type ids are version-pinned. PoiTag and PoiType were inserted at 87 and 88 in 1.26.50, which moved everything above them; the table in src/parameterTypes.ts is the one for protocol 2193, keyed by Mojang's own metadata name so the numbers and the data join on a published key.
This package does not depend on @jsprismarine/protocol or @jsprismarine/prismarine. It produces the payload and the network layer writes it, so the command layer stays free of the server. The round trip in src/packet.test.ts asserts every field fits the width the packet encodes it at (uint16 flags, uint8 permission level and options, int32 alias index, uint32 parse symbols and indices) and that every parse symbol decodes back to the table it points at.
Selectors
parseSelector(input, dialect) reads one target selector and returns one model whichever edition wrote it, and matchSelector(selector, source, { candidates, facts }) resolves that model against a list of candidates the caller supplies. The split is deliberate: the grammar belongs to the edition the string was typed in, and the matching belongs to Java's EntitySelector, which both dialects normalize onto. The order Java applies is kept because it is observable - filter, then sort, then cut to the limit - so a @p in a crowd is the nearest match of the filtered set rather than the nearest candidate that happens to pass. The facts an EntityRef does not carry (game mode, experience level, tags, scores, Bedrock's type families) arrive through an optional SelectorFacts, and a fact left out never matches a test that reads it. The dialect is a flag, not a merged grammar, because the two grammars share argument names for x, y, z, dx, dy, dz, scores, tag, name and type and disagree on everything else.
Java has 6 base selectors and the 21 arguments EntitySelectorOptions declares. Bedrock has 7 base selectors, @initiator being the extra one, and its own argument set. The parser normalizes Bedrock onto the Java spelling:
| Bedrock | Java |
|---|---|
r, rm | distance |
l, lm | level |
rx, rxm | x_rotation |
ry, rym | y_rotation |
m, with the s/0, c/1, a/2, d/5 shorthands | gamemode |
c, signed, where a negative count means furthest first | limit plus sort |
Four Java arguments have no Bedrock expression (advancements, nbt, predicate, team) and four Bedrock arguments have no Java expression (family, hasitem, haspermission, has_property). sort=arbitrary is a fifth Java-side gap, a value rather than an argument. Bedrock also allows ~ in x, y and z and a ! inside scores, neither of which Java accepts.
An argument from the other edition parses anyway and the result carries a note naming it. Dropping it silently would change which entities a command hits, and a /execute body the server itself built can legitimately carry a Java-only argument on a connection whose player is on Bedrock. SelectorSyntaxError carries the offset the parse stopped at.
The command set
registerVanillaCommands() returns a CommandRegistry holding 60 commands: the 46 names Java 26.3 and Bedrock 1.26.50 share, plus /data, /item, /attribute, /random and /return, which are Java-only and which the datapack runtime cannot work without, plus nine of Bedrock's own. Aliases are registered as redirects, so /tp, /msg, /w and /experience parse and run as their owners.
clear clone damage deop difficulty effect enchant execute fill function gamemode gamerule give
help kick kill list locate loot me op particle place playsound recipe reload ride say schedule
scoreboard setblock setworldspawn spawnpoint spreadplayers stop stopsound summon tag teleport
tell tellraw time title transfer weather xp
attribute data item random return
camerashake daylock fog playanimation replaceitem testfor testforblock testforblocks titlerawFour of the Bedrock nine are older spellings of something Java says differently, and they run the same host verbs rather than a second implementation: /testfor is execute if entity, /testforblock is execute if block, /testforblocks is execute if blocks, and /daylock is gamerule doDaylightCycle with the sense inverted. /replaceitem is the /item replace Java renamed in 1.17 and Bedrock kept, and /titleraw is /title over a rawtext object, built from the same tree so a times form cannot exist on one and not the other. /camerashake, /fog and /playanimation have no gameplay rule behind them at all: each asks the client to draw something and the server's whole part is the packet, which is why nothing about them is approximated.
A registry can also be asked to hold only part of the set. new CommandRegistry({ include }) turns a name away, and an excluded command is built but never registered, so nothing can parse it, no alias is registered for it, and the flattener never puts it in the packet. That is for a host that cannot answer every verb: a command whose body does nothing is worse than one the client was never offered. getExcludedNames() reports the difference.
/execute is a real subcommand chain, not execute <target> <command>. It has Java's 14 subcommands, each redirecting back to the execute node; 13 if/unless conditions; 8 on relations; and 5 store targets. as, at, on, positioned as, rotated as and facing entity fork, so one line runs once per matched entity, and the Brigadier port's breadth-first loop in CommandDispatcher.execute does the fan-out.
execute store needs the value a later command returns. Upstream Brigadier carries that on the source as a CommandResultCallback, which arrived with ContextChain in 2023; the port predates it. storeCommandResults(dispatcher) installs a ResultConsumer instead, which sees the same thing, one call per executed context, and feeds the sinks that withStore attached to the derived source. registerVanillaCommands wires it.
/return run <command> is built on the same machinery, because it asks the same question: Java hangs a CommandResultCallback off the source, and here the redirect to the dispatcher root attaches a withStore sink that reads what the command produced. The sink fires once per executed context, so a forked body calls it more than once and the first call is the one taken.
What a function returns, and what execute if function matches
A function returns a value only through /return. A function that reaches its last line returns nothing, and 1.20.3's rule is that nothing does not match, so execute if function is false for it however many lines it ran. DataCommandHost.runFunction therefore answers a FunctionOutcome rather than a number: result is what /function reports, which is the /return value when there was one and the number of command lines run when there was not, and matched is the condition's own answer. Neither derives from the other. A tag whose members return 1 and -1 sums to 0 and still matches, because Java matches a tag when any member did.
/return outside a function is an error, which is the host's call to make: nothing in this package knows whether a function is running.
The CommandHost seam
A command in this package is a Brigadier tree plus one or more calls into CommandHost. Nothing here imports the server, reads a world, or knows what an entity is beyond the seven fields EntityRef declares. The interface is five groups, entities, world, scoreboard, data and server, and testCommandHost(overrides) builds one whose every verb reports that nothing happened, so a test names the two or three methods the command under test calls and still gets a fully typed host rather than a cast.
CommandSource is Java's CommandSourceStack: the entity, position, rotation, dimension, anchor, permission level and silence a command runs with. Every with* method returns a copy, because a forked execute as @e runs the rest of the chain once per source and sharing mutable state between branches would make the result depend on evaluation order.
A command's return value is the count execute store result captures, so /fill returns the number of blocks it changed rather than a success flag.
/scoreboard players, execute if score and execute store ... score take a score holder rather than an entity, which is Java's ScoreHolderArgument: a selector, a bare name, or *. The bare name is the point. A scoreboard scores a name, and a name no entity has - a "fake player" - is how a datapack keeps a counter that is not about anybody, so reading those three arguments as entity selectors would have made the normal idiom unparseable.
Gamerules
1.21.11 moved gamerules into a registry and renamed every one of them from camelCase to a namespaced snake_case id. The mcfunction runtime reads two of them, minecraft:max_command_sequence_length and minecraft:max_command_forks, so anything written against maxCommandChainLength or maxCommandForkCount is stale.
JAVA_GAME_RULES holds the 59 rules Mojang's own minecraft:game_rule registry report lists for 26.3, 47 boolean and 12 integer. gameRule(name) resolves a current id, a bare id, a pre-1.21.11 camelCase name or Bedrock's lowercase name onto the same rule, and renamedGameRule(legacy) answers only the rename question.
The measured shape of the rename differs from the figure in the research note, which says 36 renamed. Mojang's own old-to-new map, the constant pool of GameRuleRegistryFix.class in the 26.3 jar, carries 59 legacy names over 58 current ones, of which 27 change more than case. Both enableCommandBlocks and commandBlocksEnabled become minecraft:command_blocks_work, which is why 59 names reach 58 ids. The 59th current rule, minecraft:fire_spread_radius_around_player, is not a rename at all: the fix folds the old booleans doFireTick and allowFireTicksAwayFromPlayer into one integer radius. The 3 removals the note reports do match, and REMOVED_GAME_RULES names them.
Defaults are stated for three rules only. Mojang has never published any gamerule default; GameRules.class in the 26.3 jar has exactly three integer constants in its pool, [32768, 65536, 2147483647], and minecraft.wiki and Pumpkin-MC/Extractor independently report 65536 for both command limits and 32768 for minecraft:max_block_modifications. The minimums come from the 1.21.11 changelog, which does state them. Every other default belongs to the world, not to this package.
Bedrock's names come from Mojang's own BoolGameRule and IntGameRule enums in the generated command table, so there is no second copy to keep in step. Bedrock has 32 boolean and 5 integer rules, 8 of which Java has no counterpart for, and it still spells the command limit maxcommandchainlength.
What is not wired yet
Constraintsis always empty. Mojang's schema names the field and stops, and gophertunnel, Cloudburst and PocketMine do not agree on what the indices mean, so nothing is written rather than guessing.- The selector argument reads with the Java grammar unless a caller passes
dialect: 'bedrock'. Wiring the dialect to the connection aCommandRequestPacketarrived on belongs to the server. In practice both dialects parse either way: a Bedrock-only argument in a Java-dialect string is normalized and noted rather than refused, so@e[r=5,c=1]reads asdistance=..5, limit=1, sort=nearest. execute if stopwatchparses and always answers false./stopwatchis a 26.x Java command with no timer behind it here yet.- 29 of Bedrock's commands are not implemented.
/allowlist,/save,/setmaxplayers,/mobevent,/tickingarea,/structure,/clearspawnpointand/toggledownfalleach need a subsystem no server here has./structureis the closest of the eight:@jsprismarine/structuresreads and writes the NBT template format, and what is still missing is somewhere for a player-made template to be saved to and read back from./camera,/hud,/music,/dialogue,/inputpermission,/controlscheme,/aimassist,/projectand/sendshowstoreoffereach need a packet this repository does not write yet; and/script,/scriptevent,/gametest,/editor-allowlist,/wsserver,/changesetting,/packstack,/permission,/event,/reloadconfig,/reloadpacketlimitconfigand/serveridentityare editor, telemetry and Script API surfaces that are out of scope by the plan section 12.
Classes
Interfaces
AnimationRequest
Defined in: commands/src/host.ts:446
What /playanimation asks a client to draw, beside the animation itself.
Properties
animation
readonlyanimation:string
Defined in: commands/src/host.ts:447
blendOutTime?
readonlyoptionalblendOutTime?:number
Defined in: commands/src/host.ts:449
controller?
readonlyoptionalcontroller?:string
Defined in: commands/src/host.ts:451
nextState?
readonlyoptionalnextState?:string
Defined in: commands/src/host.ts:448
stopExpression?
readonlyoptionalstopExpression?:string
Defined in: commands/src/host.ts:450
AvailableChainedSubcommand
Defined in: commands/src/packet.ts:79
One entry of Chained Subcommand Data.
Properties
name
readonlyname:string
Defined in: commands/src/packet.ts:80
values
readonlyvalues: readonlyobject[]
Defined in: commands/src/packet.ts:89
The value pairs.
Mojang's schema names the two members first and second and defines neither. The only datum a chained subcommand table has per entry is the keyword, so this package writes its index into Chained Subcommand Values in both members.
AvailableCommandData
Defined in: commands/src/packet.ts:58
One command, as the packet writes it.
Properties
aliasEnum
readonlyaliasEnum:number
Defined in: commands/src/packet.ts:66
Alias Enum, an int32 index into Enum Data, or -1 when the command has no aliases.
chainedSubcommandIndexes
readonlychainedSubcommandIndexes: readonlynumber[]
Defined in: commands/src/packet.ts:68
CommandData Chained Subcommand Indexes, uint32 indices into Chained Subcommand Data.
description
readonlydescription:string
Defined in: commands/src/packet.ts:60
flags
readonlyflags:number
Defined in: commands/src/packet.ts:62
Flags, a uint16.
name
readonlyname:string
Defined in: commands/src/packet.ts:59
overloads
readonlyoverloads: readonlyAvailableCommandOverload[]
Defined in: commands/src/packet.ts:69
permissionLevel
readonlypermissionLevel:number
Defined in: commands/src/packet.ts:64
Permission Level, a CommandPermissionLevel from 0 to 5.
AvailableCommandEnum
Defined in: commands/src/packet.ts:73
One entry of Enum Data: a name and the indices of its values in Enum Values.
Properties
name
readonlyname:string
Defined in: commands/src/packet.ts:74
valueIndexes
readonlyvalueIndexes: readonlynumber[]
Defined in: commands/src/packet.ts:75
AvailableCommandOverload
Defined in: commands/src/packet.ts:51
One overload of one command, as the packet writes it.
Properties
isChaining
readonlyisChaining:boolean
Defined in: commands/src/packet.ts:53
The isChaining boolean, true when the overload ends in a chained subcommand.
parameters
readonlyparameters: readonlyAvailableCommandParameter[]
Defined in: commands/src/packet.ts:54
AvailableCommandParameter
Defined in: commands/src/packet.ts:39
One parameter of one overload, as the packet writes it.
Properties
name
readonlyname:string
Defined in: commands/src/packet.ts:41
The name the client shows, written as a string.
optional
readonlyoptional:boolean
Defined in: commands/src/packet.ts:45
The Is Optional? boolean.
options
readonlyoptions:number
Defined in: commands/src/packet.ts:47
The Options byte, a CommandParameterOption mask.
parseSymbol
readonlyparseSymbol:number
Defined in: commands/src/packet.ts:43
The 32 bit Parse Symbol word.
AvailableCommandsPayload
Defined in: commands/src/packet.ts:99
The eight fields of AvailableCommandsPacket, as values.
Properties
chainedSubcommands
readonlychainedSubcommands: readonlyAvailableChainedSubcommand[]
Defined in: commands/src/packet.ts:104
chainedSubcommandValues
readonlychainedSubcommandValues: readonlystring[]
Defined in: commands/src/packet.ts:101
commands
readonlycommands: readonlyAvailableCommandData[]
Defined in: commands/src/packet.ts:105
constraints
readonlyconstraints: readonlyobject[]
Defined in: commands/src/packet.ts:107
enums
readonlyenums: readonlyAvailableCommandEnum[]
Defined in: commands/src/packet.ts:103
enumValues
readonlyenumValues: readonlystring[]
Defined in: commands/src/packet.ts:100
postfixes
readonlypostfixes: readonlystring[]
Defined in: commands/src/packet.ts:102
softEnums
readonlysoftEnums: readonlyAvailableSoftEnum[]
Defined in: commands/src/packet.ts:106
AvailableSoftEnum
Defined in: commands/src/packet.ts:93
One entry of Soft Enums, whose values travel as strings rather than indices.
Properties
name
readonlyname:string
Defined in: commands/src/packet.ts:94
values
readonlyvalues: readonlystring[]
Defined in: commands/src/packet.ts:95
BedrockCommandCounts
Defined in: commands/src/bedrockTable.ts:54
How many of each thing the pinned metadata declares.
Properties
basicTypes
readonlybasicTypes:number
Defined in: commands/src/bedrockTable.ts:60
commands
readonlycommands:number
Defined in: commands/src/bedrockTable.ts:55
enums
readonlyenums:number
Defined in: commands/src/bedrockTable.ts:58
enumValues
readonlyenumValues:number
Defined in: commands/src/bedrockTable.ts:59
overloads
readonlyoverloads:number
Defined in: commands/src/bedrockTable.ts:56
parameters
readonlyparameters:number
Defined in: commands/src/bedrockTable.ts:57
softEnums
readonlysoftEnums:number
Defined in: commands/src/bedrockTable.ts:61
BedrockCommandDefinition
Defined in: commands/src/bedrockTable.ts:30
One Bedrock command as Mojang declares it.
Properties
aliases
readonlyaliases: readonlystring[]
Defined in: commands/src/bedrockTable.ts:36
Other names the command answers to.
description
readonlydescription:string
Defined in: commands/src/bedrockTable.ts:34
The one-line description the client shows.
name
readonlyname:string
Defined in: commands/src/bedrockTable.ts:32
The command name without a leading slash.
overloads
readonlyoverloads: readonlyBedrockCommandOverload[]
Defined in: commands/src/bedrockTable.ts:42
Every spelling of the command, in Mojang's order.
permissionLevel
readonlypermissionLevel:number
Defined in: commands/src/bedrockTable.ts:38
The CommandPermissionLevel the command needs, 0 (Any) to 5 (Internal).
requiresCheats
readonlyrequiresCheats:boolean
Defined in: commands/src/bedrockTable.ts:40
Whether the world must have cheats on for the command to run.
BedrockCommandEnum
Defined in: commands/src/bedrockTable.ts:46
One command enum: a fixed value list a parameter can take.
Properties
name
readonlyname:string
Defined in: commands/src/bedrockTable.ts:48
The name Mojang declares, which is what goes on the wire.
values
readonlyvalues: readonlystring[]
Defined in: commands/src/bedrockTable.ts:50
The values, empty for a soft enum the server fills at runtime.
BedrockCommandOverload
Defined in: commands/src/bedrockTable.ts:22
One overload of one Bedrock command: an ordered parameter list.
Properties
name
readonlyname:string
Defined in: commands/src/bedrockTable.ts:24
Mojang's name for the overload, usually its index as a string.
parameters
readonlyparameters: readonlyBedrockCommandParameter[]
Defined in: commands/src/bedrockTable.ts:26
The parameters in the order the client parses them.
BedrockCommandParameter
Defined in: commands/src/bedrockTable.ts:12
One parameter of one Bedrock command overload.
Properties
name
readonlyname:string
Defined in: commands/src/bedrockTable.ts:14
The name the client shows in its autocomplete, Mojang's own spelling.
optional
readonlyoptional:boolean
Defined in: commands/src/bedrockTable.ts:18
Whether the overload parses without this parameter.
type
readonlytype:string
Defined in: commands/src/bedrockTable.ts:16
The upper-case parameter type name, either a basic type or a command enum.
BedrockCommandTable
Defined in: commands/src/bedrockTable.ts:65
The generated Bedrock command table.
Properties
basicTypes
readonlybasicTypes: readonlyobject[]
Defined in: commands/src/bedrockTable.ts:71
Every parameter type name that is not a command enum, with its use count, most used first.
commands
readonlycommands: readonlyBedrockCommandDefinition[]
Defined in: commands/src/bedrockTable.ts:77
Every command, in Mojang's order.
counts
readonlycounts:BedrockCommandCounts
Defined in: commands/src/bedrockTable.ts:69
The measured counts, which the package's tests assert against.
enums
readonlyenums: readonlyBedrockCommandEnum[]
Defined in: commands/src/bedrockTable.ts:75
Every command enum, sorted by name.
softEnums
readonlysoftEnums: readonlystring[]
Defined in: commands/src/bedrockTable.ts:73
The enums declared with no values, which the server fills over UpdateSoftEnumPacket.
source
readonlysource:object
Defined in: commands/src/bedrockTable.ts:67
The pinned Mojang/bedrock-samples commit the table was read from.
commit
readonlycommit:string
path
readonlypath:string
repo
readonlyrepo:string
tag
readonlytag:string
BedrockDescribedType
Defined in: commands/src/argumentTypes.ts:20
An argument type that can describe itself to a Bedrock client.
Extends
ArgumentType<T>
Type Parameters
T
T
Properties
bedrockGap?
readonlyoptionalbedrockGap?:string
Defined in: commands/src/argumentTypes.ts:29
Why Bedrock cannot express it, set exactly when describeBedrock answers undefined.
Methods
describeBedrock()
describeBedrock():
BedrockParameterShape|undefined
Defined in: commands/src/argumentTypes.ts:27
The wire shape of this argument.
Returns
BedrockParameterShape | undefined
The shape, or undefined when none of Bedrock's 26 parameter types expresses it.
getExamples()?
optionalgetExamples():Iterable<string>
Defined in: brigadier/src/arguments/ArgumentType.ts:32
Returns
Iterable<string>
Inherited from
listSuggestions()?
optionallistSuggestions<S>(context,builder):Promise<Suggestions>
Defined in: brigadier/src/arguments/ArgumentType.ts:30
Type Parameters
S
S
Parameters
context
builder
Returns
Promise<Suggestions>
Inherited from
parse()
parse(
reader,context):T
Defined in: brigadier/src/arguments/ArgumentType.ts:28
Parameters
reader
context
ArgumentParseContext<any>
Returns
T
Inherited from
BlockRef
Defined in: commands/src/host.ts:49
A block, as /setblock and execute if block talk about one.
Properties
identifier
readonlyidentifier:string
Defined in: commands/src/host.ts:51
The namespaced block identifier.
states
readonlystates:Readonly<Record<string,string|number|boolean>>
Defined in: commands/src/host.ts:53
The block states, as a Bedrock ["name"="value"] list parses into.
BuildAvailableCommandsOptions
Defined in: commands/src/packet.ts:122
How to build.
Extends
Type Parameters
S
S
Properties
overloadLimit?
readonlyoptionaloverloadLimit?:number
Defined in: commands/src/flatten.ts:122
The most overloads one command may produce before the expansion is cut and noted. Mojang's widest command has 18.
Inherited from
softEnumValues?
readonlyoptionalsoftEnumValues?:Readonly<Record<string, readonlystring[]>>
Defined in: commands/src/packet.ts:128
Values for the soft enums the tree refers to, keyed by enum name. A soft enum with no entry here is sent empty, which is what vanilla does before the first UpdateSoftEnumPacket.
source?
readonlyoptionalsource?:S
Defined in: commands/src/flatten.ts:117
Filter the tree the way Java does, by CommandNode.canUse, so a player is only shown the commands they may run. Omit to flatten the whole tree.
Inherited from
BuildAvailableCommandsResult
Defined in: commands/src/packet.ts:115
A built payload and the cost of flattening the tree into it.
Properties
notes
readonlynotes: readonlyFlattenNote[]
Defined in: commands/src/packet.ts:118
Every node the flattener could not carry across unchanged.
payload
readonlypayload:AvailableCommandsPayload
Defined in: commands/src/packet.ts:116
CameraShake
Defined in: commands/src/host.ts:427
What /camerashake asks a client to do.
Properties
action
readonlyaction:"add"|"stop"
Defined in: commands/src/host.ts:428
intensity
readonlyintensity:number
Defined in: commands/src/host.ts:429
seconds
readonlyseconds:number
Defined in: commands/src/host.ts:430
shakeType
readonlyshakeType:"positional"|"rotational"
Defined in: commands/src/host.ts:431
ChainedSubcommandTable
Defined in: commands/src/flatten.ts:87
One chained-subcommand table entry: a name and the keywords it covers.
Properties
name
readonlyname:string
Defined in: commands/src/flatten.ts:88
values
readonlyvalues: readonlystring[]
Defined in: commands/src/flatten.ts:89
CommandHost
Defined in: commands/src/host.ts:529
Everything a command in this package can ask the server to do.
Properties
data
readonlydata:DataCommandHost
Defined in: commands/src/host.ts:533
entities
readonlyentities:EntityCommandHost
Defined in: commands/src/host.ts:530
scoreboard
readonlyscoreboard:ScoreboardCommandHost
Defined in: commands/src/host.ts:532
server
readonlyserver:ServerCommandHost
Defined in: commands/src/host.ts:534
world
readonlyworld:WorldCommandHost
Defined in: commands/src/host.ts:531
CommandMetadata
Defined in: commands/src/tree.ts:19
The per-command data AvailableCommandsPacket carries and Brigadier does not.
Properties
aliases
readonlyaliases: readonlystring[]
Defined in: commands/src/tree.ts:23
Other names the command answers to.
description
readonlydescription:string
Defined in: commands/src/tree.ts:21
The one-line description the Bedrock client shows next to the name.
flags
readonlyflags:number
Defined in: commands/src/tree.ts:32
The CommandData.Flags word.
Mojang documents the field as a uint16 and never enumerates the bits, so 0 is the only safe default and the one this package writes.
permissionLevel
readonlypermissionLevel:CommandPermissionLevel
Defined in: commands/src/tree.ts:25
The CommandPermissionLevel the command needs.
requiresCheats
readonlyrequiresCheats:boolean
Defined in: commands/src/tree.ts:34
Whether the world must have cheats on, as Mojang's own metadata records it.
CommandRegistryOptions
Defined in: commands/src/tree.ts:70
How a registry decides what it will hold.
Properties
content?
readonlyoptionalcontent?:ContentRegistryIds
Defined in: commands/src/tree.ts:76
What the host's own registries hold. Omit it and every registry argument validates against Mojang's published enum alone, which is right for a host with no content build behind it.
include?
readonlyoptionalinclude?: (name) =>boolean
Defined in: commands/src/tree.ts:87
Which command names this registry accepts. A name this answers false for is built and handed back, but never reaches the dispatcher or the metadata table, so nothing can parse it and the flattener never sees it.
The point is a host that cannot answer every verb a command set calls. A command whose body would run against a subsystem the server has not built is worse than an absent one: the client offers it, the player types it, and nothing happens. Omit the option to hold everything.
Parameters
name
string
Returns
boolean
CommandResultSink()
Defined in: commands/src/host.ts:545
What execute store attaches to a derived source so the value a later command produces reaches a score, an NBT path or a boss bar.
Upstream Brigadier carries this as a CommandResultCallback on the source; the port predates ContextChain, so the dispatcher's ResultConsumer feeds the sinks instead. See storeCommandResults.
CommandResultSink(
outcome):void
Defined in: commands/src/host.ts:547
Whether the command succeeded, and the number it returned.
Parameters
outcome
success
boolean
value
number
Returns
void
CommandSource
Defined in: commands/src/host.ts:558
Java's CommandSourceStack: who is running a command, from where, and with what authority.
Every with* method returns a copy. execute as @e runs the rest of the chain once per matched entity, and sharing mutable state between those branches would make the result depend on evaluation order.
Properties
anchor
readonlyanchor:EntityAnchor
Defined in: commands/src/host.ts:565
dialect
readonlydialect:SelectorDialect
Defined in: commands/src/host.ts:571
Which grammar a selector in this command's arguments is read with.
dimension
readonlydimension:string
Defined in: commands/src/host.ts:564
entity?
readonlyoptionalentity?:EntityRef
Defined in: commands/src/host.ts:561
The entity the command runs as, absent for the console.
host
readonlyhost:CommandHost
Defined in: commands/src/host.ts:559
permissionLevel
readonlypermissionLevel:number
Defined in: commands/src/host.ts:567
0 to 5, compared against a command's CommandPermissionLevel.
position
readonlyposition:Vector3
Defined in: commands/src/host.ts:562
rotation
readonlyrotation:Rotation
Defined in: commands/src/host.ts:563
silent
readonlysilent:boolean
Defined in: commands/src/host.ts:569
True inside a function, where output does not reach chat.
stores
readonlystores: readonlyCommandResultSink[]
Defined in: commands/src/host.ts:573
The execute store sinks waiting for this command's result.
Methods
sendError()
sendError(
message):void
Defined in: commands/src/host.ts:587
Reports a failure, which is never suppressed.
Parameters
message
string
Returns
void
sendFeedback()
sendFeedback(
message):void
Defined in: commands/src/host.ts:585
Reports success to whoever ran the command, unless the source is silent.
Parameters
message
string
Returns
void
withAnchor()
withAnchor(
anchor):CommandSource
Defined in: commands/src/host.ts:579
Parameters
anchor
Returns
withDimension()
withDimension(
dimension):CommandSource
Defined in: commands/src/host.ts:578
Parameters
dimension
string
Returns
withEntity()
withEntity(
entity):CommandSource
Defined in: commands/src/host.ts:575
Parameters
entity
EntityRef | undefined
Returns
withPosition()
withPosition(
position):CommandSource
Defined in: commands/src/host.ts:576
Parameters
position
Returns
withRotation()
withRotation(
rotation):CommandSource
Defined in: commands/src/host.ts:577
Parameters
rotation
Returns
withSilent()
withSilent(
silent):CommandSource
Defined in: commands/src/host.ts:580
Parameters
silent
boolean
Returns
withStore()
withStore(
sink):CommandSource
Defined in: commands/src/host.ts:582
Adds an execute store sink, keeping the ones already attached.
Parameters
sink
Returns
CommandSourceInput
Defined in: commands/src/host.ts:591
The fields createCommandSource needs, everything else having a default.
Properties
anchor?
readonlyoptionalanchor?:EntityAnchor
Defined in: commands/src/host.ts:597
dialect?
readonlyoptionaldialect?:SelectorDialect
Defined in: commands/src/host.ts:600
dimension?
readonlyoptionaldimension?:string
Defined in: commands/src/host.ts:596
entity?
readonlyoptionalentity?:EntityRef
Defined in: commands/src/host.ts:593
host
readonlyhost:CommandHost
Defined in: commands/src/host.ts:592
onError?
readonlyoptionalonError?: (message) =>void
Defined in: commands/src/host.ts:604
Where errors go. The default drops them.
Parameters
message
string
Returns
void
onFeedback?
readonlyoptionalonFeedback?: (message) =>void
Defined in: commands/src/host.ts:602
Where feedback goes. The default drops it.
Parameters
message
string
Returns
void
permissionLevel?
readonlyoptionalpermissionLevel?:number
Defined in: commands/src/host.ts:598
position?
readonlyoptionalposition?:Vector3
Defined in: commands/src/host.ts:594
rotation?
readonlyoptionalrotation?:Rotation
Defined in: commands/src/host.ts:595
silent?
readonlyoptionalsilent?:boolean
Defined in: commands/src/host.ts:599
ContentRegistryIds
Defined in: commands/src/tree.ts:56
The ids the host's own registries hold, for the arguments that validate against live content instead of against Mojang's frozen list.
Only the four registries a host resolves an id against and a content pack can extend are here. minecraft:damage_type and minecraft:mob_effect stay pinned to Mojang's published enum: no host here keeps a registry for either, so the published list is the only list there is. minecraft:attribute, minecraft:particle_type and minecraft:worldgen/biome are absent for a different reason, which is that Bedrock publishes no enum for them and they already degrade to an unvalidated string.
A list left out keeps Mojang's published enum on its own, which is what a caller with no content build wants.
Properties
blocks?
readonlyoptionalblocks?: readonlystring[]
Defined in: commands/src/tree.ts:60
Every block identifier the host can place, for /setblock and /fill.
damageTypes?
readonlyoptionaldamageTypes?: readonlystring[]
Defined in: commands/src/tree.ts:66
Every damage type the loaded datapacks declare, /damage's argument.
enchantments?
readonlyoptionalenchantments?: readonlystring[]
Defined in: commands/src/tree.ts:64
Every enchantment id the host can apply.
entityTypes?
readonlyoptionalentityTypes?: readonlystring[]
Defined in: commands/src/tree.ts:58
Every entity identifier the host can spawn, /summon's argument.
items?
readonlyoptionalitems?: readonlystring[]
Defined in: commands/src/tree.ts:62
Every item identifier the host can give.
Coordinate
Defined in: commands/src/argumentTypes.ts:63
One coordinate of a position argument.
Properties
mode
readonlymode:CoordinateMode
Defined in: commands/src/argumentTypes.ts:65
value
readonlyvalue:number
Defined in: commands/src/argumentTypes.ts:64
DamageOrigin
Defined in: commands/src/host.ts:519
The optional source clauses of /damage <target> <amount> <type> [at <location>] [by <entity> [from <cause>]].
Properties
at?
readonlyoptionalat?:Vector3
Defined in: commands/src/host.ts:525
at: the point the blow came from.
by?
readonlyoptionalby?:EntityRef
Defined in: commands/src/host.ts:521
by: the entity that made contact, such as an arrow or the attacker's fist.
from?
readonlyoptionalfrom?:EntityRef
Defined in: commands/src/host.ts:523
from: the entity answerable for by, such as the archer.
DataCommandHost
Defined in: commands/src/host.ts:269
The NBT, loot and function verbs a command needs.
Methods
applyItemModifier()
applyItemModifier(
target,slot,modifier):number
Defined in: commands/src/host.ts:284
Applies a standalone item modifier to the items in a slot.
Parameters
target
slot
modifier
string
Returns
number
clearSchedule()
clearSchedule(
name):number
Defined in: commands/src/host.ts:331
Parameters
name
string
Returns
number
copySlots()
copySlots(
from,fromSlot,to,toSlot,modifier?):number
Defined in: commands/src/host.ts:302
Copies items from one slot range to another, optionally through a modifier.
Parameters
from
fromSlot
to
toSlot
modifier?
string
Returns
number
countData()
countData(
target,path):number
Defined in: commands/src/host.ts:273
Parameters
target
path
string
Returns
number
How many elements the path matched.
getData()
getData(
target,path?):string|undefined
Defined in: commands/src/host.ts:271
Parameters
target
path?
string
Returns
string | undefined
The value at the path, as SNBT source, or undefined when the path matches nothing.
mergeData()
mergeData(
target,nbt):boolean
Defined in: commands/src/host.ts:274
Parameters
target
nbt
string
Returns
boolean
modifyData()
modifyData(
target,path,operation,value,index?):boolean
Defined in: commands/src/host.ts:275
Parameters
target
path
string
operation
value
string
index?
number
Returns
boolean
randomValue()
randomValue(
min,max,sequence?):number
Defined in: commands/src/host.ts:333
Draws from a named random sequence, as /random does.
Parameters
min
number
max
number
sequence?
string
Returns
number
removeData()
removeData(
target,path):boolean
Defined in: commands/src/host.ts:282
Parameters
target
path
string
Returns
boolean
resetRandomSequence()
resetRandomSequence(
sequence,seed?):boolean
Defined in: commands/src/host.ts:334
Parameters
sequence
string
seed?
number
Returns
boolean
returnFromFunction()
returnFromFunction(
value):number
Defined in: commands/src/host.ts:328
Ends the function the running command line belongs to, which is /return.
Parameters
value
number | undefined
What the function returns. Undefined for return fail and for a return run whose command failed, both of which end the function without a value.
Returns
number
What the /return line itself reports, which is the value, or 0 when there is none.
Throws
When no function is running. Java refuses /return typed at a console or a chat window the same way.
runFunction()
runFunction(
name,source,nbt?):FunctionOutcome
Defined in: commands/src/host.ts:315
Runs a function or #tag; see FunctionOutcome for the two things a call reports.
Parameters
name
string
source
nbt?
string
Returns
runLoot()
runLoot(
loot,source,destination):number
Defined in: commands/src/host.ts:311
Rolls loot and delivers it.
Parameters
loot
What to roll. /loot kill and /loot mine roll the table of the entity or block they name rather than one the player typed, so the four forms are a model rather than a table id.
source
destination
Returns
number
How many items were delivered.
schedule()
schedule(
name,delayTicks,mode):boolean
Defined in: commands/src/host.ts:330
Queues a function for later.
Parameters
name
string
delayTicks
number
mode
"replace" | "append"
Returns
boolean
setSlot()
setSlot(
target,slot,item,count,mode?):number
Defined in: commands/src/host.ts:294
Puts an item stack directly into a slot.
Parameters
target
slot
item
string
count
number
mode?
"replace" | "destroy" | "keep"
What to do with what is already there. replace, Java's only behavior, is the default; keep leaves an occupied slot alone and destroy is Bedrock's explicit spelling of replace, both from /replaceitem.
Returns
number
How many items were put in.
testPredicate()
testPredicate(
predicate,source):boolean
Defined in: commands/src/host.ts:313
Evaluates a datapack predicate, for execute if predicate.
Parameters
predicate
string
source
Returns
boolean
EntityCommandHost
Defined in: commands/src/host.ts:102
The entity-side verbs a command needs.
Methods
addAttributeModifier()
addAttributeModifier(
entity,attribute,id,value,operation):boolean
Defined in: commands/src/host.ts:156
Parameters
entity
attribute
string
id
string
value
number
operation
"add_value" | "add_multiplied_base" | "add_multiplied_total"
Returns
boolean
addEffect()
addEffect(
entity,effect,seconds,amplifier,hideParticles):boolean
Defined in: commands/src/host.ts:136
Parameters
entity
effect
string
seconds
number
amplifier
number
hideParticles
boolean
Returns
boolean
addTag()
addTag(
entity,tag):boolean
Defined in: commands/src/host.ts:150
Parameters
entity
tag
string
Returns
boolean
changeExperience()
changeExperience(
player,amount,unit,mode):number
Defined in: commands/src/host.ts:148
Adds to, or replaces, a player's experience.
Parameters
player
amount
number
unit
"points" | "levels"
mode
"set" | "add"
add is /xp add and set is /xp set. The two differ by more than arithmetic: Java's set ... points writes the bar fraction rather than adding points that carry into a level.
Returns
number
The player's experience after the change, in unit.
clearEffect()
clearEffect(
entity,effect?):number
Defined in: commands/src/host.ts:138
Parameters
entity
effect?
string
Returns
number
How many effects were cleared.
clearItems()
clearItems(
player,item,data,maxCount):number
Defined in: commands/src/host.ts:133
Parameters
player
item
string | undefined
data
number | undefined
maxCount
number
Returns
number
How many items were removed.
countItems()
countItems(
player,item,data):number
Defined in: commands/src/host.ts:135
Parameters
player
item
string | undefined
data
number | undefined
Returns
number
How many items match, without removing any of them.
damage()
damage(
entity,amount,damageType,origin?):boolean
Defined in: commands/src/host.ts:125
Applies /damage.
Parameters
entity
amount
number
damageType
string
A damage type id such as minecraft:in_fire; minecraft:generic by default.
origin?
Who and where it came from. Without it the blow has no source entity, which is what Java does for a bare /damage, whoever ran the command.
Returns
boolean
enchant()
enchant(
entity,enchantment,level):boolean
Defined in: commands/src/host.ts:139
Parameters
entity
enchantment
string
level
number
Returns
boolean
getAttributeBase()
getAttributeBase(
entity,attribute):number|undefined
Defined in: commands/src/host.ts:153
Parameters
entity
attribute
string
Returns
number | undefined
getAttributeModifier()
getAttributeModifier(
entity,attribute,id):number|undefined
Defined in: commands/src/host.ts:164
Parameters
entity
attribute
string
id
string
Returns
number | undefined
getAttributeValue()
getAttributeValue(
entity,attribute):number|undefined
Defined in: commands/src/host.ts:155
Parameters
entity
attribute
string
Returns
number | undefined
giveItem()
giveItem(
player,item,count,data):number
Defined in: commands/src/host.ts:131
Parameters
player
item
string
count
number
data
number
Returns
number
How many items were actually given.
kill()
kill(
entity):boolean
Defined in: commands/src/host.ts:118
Parameters
entity
Returns
boolean
listTags()
listTags(
entity): readonlystring[]
Defined in: commands/src/host.ts:152
Parameters
entity
Returns
readonly string[]
queryExperience()
queryExperience(
player,unit):number
Defined in: commands/src/host.ts:149
Parameters
player
unit
"points" | "levels"
Returns
number
related()
related(
entity,relation): readonlyEntityRef[]
Defined in: commands/src/host.ts:106
Follows one of execute on's eight relationships.
Parameters
entity
relation
Returns
readonly EntityRef[]
removeAttributeModifier()
removeAttributeModifier(
entity,attribute,id):boolean
Defined in: commands/src/host.ts:163
Parameters
entity
attribute
string
id
string
Returns
boolean
removeTag()
removeTag(
entity,tag):boolean
Defined in: commands/src/host.ts:151
Parameters
entity
tag
string
Returns
boolean
ride()
ride(
rider,vehicle):boolean
Defined in: commands/src/host.ts:128
Mounts rider on vehicle, or dismounts it when vehicle is undefined.
Parameters
rider
vehicle
EntityRef | undefined
Returns
boolean
select()
select(
selector,source): readonlyEntityRef[]
Defined in: commands/src/host.ts:104
Resolves a selector against the world, in the source's frame of reference.
Parameters
selector
source
Returns
readonly EntityRef[]
setAttributeBase()
setAttributeBase(
entity,attribute,value):boolean
Defined in: commands/src/host.ts:154
Parameters
entity
attribute
string
value
number
Returns
boolean
setGameMode()
setGameMode(
player,gameMode):boolean
Defined in: commands/src/host.ts:129
Parameters
player
gameMode
string
Returns
boolean
summon()
summon(
type,position,rotation,options):EntityRef|undefined
Defined in: commands/src/host.ts:107
Parameters
type
string
position
rotation
options
dimension?
string
Dimension of the command source, including changes made by /execute in.
name?
string
nbt?
string
Returns
EntityRef | undefined
teleport()
teleport(
entity,position,rotation,dimension):boolean
Defined in: commands/src/host.ts:126
Parameters
entity
position
rotation
dimension
string
Returns
boolean
EntityRef
Defined in: commands/src/host.ts:35
What a command needs to know about an entity it has selected.
Properties
dimension
readonlydimension:string
Defined in: commands/src/host.ts:45
id
readonlyid:string
Defined in: commands/src/host.ts:37
A stable id the host can resolve back to its own entity object.
isPlayer
readonlyisPlayer:boolean
Defined in: commands/src/host.ts:42
name
readonlyname:string
Defined in: commands/src/host.ts:41
The name a selector's name= matches and a message addresses.
position
readonlyposition:Vector3
Defined in: commands/src/host.ts:43
rotation
readonlyrotation:Rotation
Defined in: commands/src/host.ts:44
type
readonlytype:string
Defined in: commands/src/host.ts:39
The namespaced entity type, minecraft:pig.
FlattenNote
Defined in: commands/src/flatten.ts:62
One thing the flattener could not carry across unchanged.
Properties
command
readonlycommand:string
Defined in: commands/src/flatten.ts:64
The root command the node belongs to.
message
readonlymessage:string
Defined in: commands/src/flatten.ts:69
path
readonlypath:string
Defined in: commands/src/flatten.ts:66
The node path, space separated, as a usage string spells it.
reason
readonlyreason:FlattenReason
Defined in: commands/src/flatten.ts:67
severity
readonlyseverity:FlattenSeverity
Defined in: commands/src/flatten.ts:68
FlattenOptions
Defined in: commands/src/flatten.ts:112
How to flatten.
Extended by
Type Parameters
S
S
Properties
overloadLimit?
readonlyoptionaloverloadLimit?:number
Defined in: commands/src/flatten.ts:122
The most overloads one command may produce before the expansion is cut and noted. Mojang's widest command has 18.
source?
readonlyoptionalsource?:S
Defined in: commands/src/flatten.ts:117
Filter the tree the way Java does, by CommandNode.canUse, so a player is only shown the commands they may run. Omit to flatten the whole tree.
FlattenResult
Defined in: commands/src/flatten.ts:105
A flattened tree and everything the flattening cost.
Properties
commands
readonlycommands: readonlyFlattenedCommand[]
Defined in: commands/src/flatten.ts:106
notes
readonlynotes: readonlyFlattenNote[]
Defined in: commands/src/flatten.ts:108
Every node the flattener could not carry across unchanged.
FlattenedCommand
Defined in: commands/src/flatten.ts:93
One command as Bedrock's packet wants it.
Properties
aliases
readonlyaliases: readonlystring[]
Defined in: commands/src/flatten.ts:96
chainedSubcommands
readonlychainedSubcommands: readonlyChainedSubcommandTable[]
Defined in: commands/src/flatten.ts:101
The chained-subcommand tables this command's overloads point at.
description
readonlydescription:string
Defined in: commands/src/flatten.ts:95
flags
readonlyflags:number
Defined in: commands/src/flatten.ts:98
name
readonlyname:string
Defined in: commands/src/flatten.ts:94
overloads
readonlyoverloads: readonlyFlattenedOverload[]
Defined in: commands/src/flatten.ts:99
permissionLevel
readonlypermissionLevel:number
Defined in: commands/src/flatten.ts:97
FlattenedOverload
Defined in: commands/src/flatten.ts:80
One flattened overload: the parameters a client types, in order.
Properties
chaining
readonlychaining:boolean
Defined in: commands/src/flatten.ts:83
True when the overload ends in a chained subcommand parameter.
parameters
readonlyparameters: readonlyFlattenedParameter[]
Defined in: commands/src/flatten.ts:81
FlattenedParameter
Defined in: commands/src/flatten.ts:73
One parameter of a flattened overload.
Properties
name
readonlyname:string
Defined in: commands/src/flatten.ts:74
optional
readonlyoptional:boolean
Defined in: commands/src/flatten.ts:76
shape
readonlyshape:BedrockParameterShape
Defined in: commands/src/flatten.ts:75
FunctionOutcome
Defined in: commands/src/host.ts:348
What running a function or a function tag produced.
Two commands read a call and they want different answers, so neither field derives from the other. /function reports result; Java made it the /return value in 1.20.3 and the number of lines run before that, and it is still both depending on whether the function reached a /return. execute if function reads matched, which Java defines as "returned a non-zero value through /return", so a function that ran 40 lines and never returned reports 40 and does not match.
Properties
matched
readonlymatched:boolean
Defined in: commands/src/host.ts:361
Whether any function the call ran returned a non-zero value through /return. A tag matches when any of its members did, which is why this is not result !== 0: members returning 1 and -1 sum to 0 and still match.
result
readonlyresult:number
Defined in: commands/src/host.ts:354
What /function reports and execute store result captures: the sum of the values /return produced, or the number of command lines that ran when nothing the call reached returned a value.
GameRule
Defined in: commands/src/gamerules.ts:35
One gamerule of the 26.3 minecraft:game_rule registry.
Properties
bedrockName?
readonlyoptionalbedrockName?:string
Defined in: commands/src/gamerules.ts:42
Bedrock's lowercase unnamespaced name, when Bedrock has this rule.
default?
readonlyoptionaldefault?:number
Defined in: commands/src/gamerules.ts:46
The default, where this repository has a source for it.
legacyNames
readonlylegacyNames: readonlystring[]
Defined in: commands/src/gamerules.ts:40
The camelCase names a pre-1.21.11 world or command used.
min?
readonlyoptionalmin?:number
Defined in: commands/src/gamerules.ts:44
The smallest value 1.21.11 accepts, where it states one.
name
readonlyname:string
Defined in: commands/src/gamerules.ts:37
The namespaced id 1.21.11 gave it.
type
readonlytype:GameRuleType
Defined in: commands/src/gamerules.ts:38
IntegerRange
Defined in: commands/src/argumentTypes.ts:72
An inclusive integer range, as minecraft:int_range and FULLINTEGERRANGE spell it.
Properties
max?
readonlyoptionalmax?:number
Defined in: commands/src/argumentTypes.ts:74
min?
readonlyoptionalmin?:number
Defined in: commands/src/argumentTypes.ts:73
ItemSlot
Defined in: commands/src/host.ts:75
What /item, /loot replace and /replaceitem address.
Properties
count?
readonlyoptionalcount?:number
Defined in: commands/src/host.ts:78
index?
readonlyoptionalindex?:number
Defined in: commands/src/host.ts:86
The position inside a multi-slot group.
Java names one slot with one string, container.3. Bedrock splits the two, /replaceitem entity @s slot.hotbar 3, so the index travels beside the name rather than being parsed back out of it.
name
readonlyname:string
Defined in: commands/src/host.ts:77
The slot name, container.0 or weapon.mainhand.
MatchSelectorOptions
Defined in: commands/src/matching.ts:44
What matchSelector needs besides the selector itself.
Properties
candidates
readonlycandidates: readonlyEntityRef[]
Defined in: commands/src/matching.ts:46
The candidates to filter, usually every entity in the source's dimension.
facts?
readonlyoptionalfacts?:Partial<SelectorFacts>
Defined in: commands/src/matching.ts:51
The facts an EntityRef does not carry. A fact left out answers undefined, so any test that reads it fails.
random?
readonlyoptionalrandom?: () =>number
Defined in: commands/src/matching.ts:53
Where sort=random and @r draw from. Defaults to Math.random.
Returns
number
Rotation
Defined in: commands/src/host.ts:26
A facing, in degrees.
Properties
pitch
readonlypitch:number
Defined in: commands/src/host.ts:28
yaw
readonlyyaw:number
Defined in: commands/src/host.ts:27
ScoreboardCommandHost
Defined in: commands/src/host.ts:241
The scoreboard verbs a command needs.
Methods
addObjective()
addObjective(
name,criterion,displayName?):boolean
Defined in: commands/src/host.ts:242
Parameters
name
string
criterion
string
displayName?
string
Returns
boolean
addScore()
addScore(
holder,objective,value):number
Defined in: commands/src/host.ts:254
Parameters
holder
string
objective
string
value
number
Returns
number
enableTrigger()
enableTrigger(
holder,objective):boolean
Defined in: commands/src/host.ts:265
Parameters
holder
string
objective
string
Returns
boolean
getScore()
getScore(
holder,objective):number|undefined
Defined in: commands/src/host.ts:252
Parameters
holder
string
objective
string
Returns
number | undefined
holders()
holders(
objective?): readonlystring[]
Defined in: commands/src/host.ts:251
Every holder the board tracks, which is what a * score holder names.
Parameters
objective?
string
Narrows it to the holders with a score in that one.
Returns
readonly string[]
listObjectives()
listObjectives(): readonly
string[]
Defined in: commands/src/host.ts:244
Returns
readonly string[]
listScores()
listScores(
holder):Readonly<Record<string,number>>
Defined in: commands/src/host.ts:256
Parameters
holder
string
Returns
Readonly<Record<string, number>>
operation()
operation(
target,targetObjective,operation,source,sourceObjective):number|undefined
Defined in: commands/src/host.ts:258
Parameters
target
string
targetObjective
string
operation
string
source
string
sourceObjective
string
Returns
number | undefined
The target's score after the operation, or undefined when it did not apply.
removeObjective()
removeObjective(
name):boolean
Defined in: commands/src/host.ts:243
Parameters
name
string
Returns
boolean
resetScore()
resetScore(
holder,objective?):boolean
Defined in: commands/src/host.ts:255
Parameters
holder
string
objective?
string
Returns
boolean
setDisplay()
setDisplay(
slot,objective?,sortOrder?):boolean
Defined in: commands/src/host.ts:245
Parameters
slot
string
objective?
string
sortOrder?
"ascending" | "descending"
Returns
boolean
setScore()
setScore(
holder,objective,value):number
Defined in: commands/src/host.ts:253
Parameters
holder
string
objective
string
value
number
Returns
number
SelectorAdvancementTest
Defined in: commands/src/selector.ts:60
An advancements={id=bool} or advancements={id={criterion=bool}} entry, Java only.
Properties
advancement
readonlyadvancement:string
Defined in: commands/src/selector.ts:61
criteria?
readonlyoptionalcriteria?:Readonly<Record<string,boolean>>
Defined in: commands/src/selector.ts:65
Per-criterion tests, present when the value was an object.
granted?
readonlyoptionalgranted?:boolean
Defined in: commands/src/selector.ts:63
The whole-advancement test, present when the value was a boolean.
SelectorCoordinate
Defined in: commands/src/selector.ts:40
One coordinate, either absolute or relative to the selector's origin.
Properties
relative
readonlyrelative:boolean
Defined in: commands/src/selector.ts:43
True for ~, which Bedrock allows in x, y and z and Java does not.
value
readonlyvalue:number
Defined in: commands/src/selector.ts:41
SelectorFacts
Defined in: commands/src/matching.ts:30
The facts a selector tests that an EntityRef does not carry.
Each is optional, and an absent answer never matches a test that asks for it: Java's gamemode= cannot select an entity that has no game mode, so a host that does not track one is told apart from a host that tracks it and disagrees.
Methods
families()
families(
entity): readonlystring[]
Defined in: commands/src/matching.ts:40
The minecraft:type_family values Bedrock's family= tests.
Parameters
entity
Returns
readonly string[]
gameMode()
gameMode(
entity):string|undefined
Defined in: commands/src/matching.ts:32
The player's game mode, unnamespaced, as gamemode= spells it.
Parameters
entity
Returns
string | undefined
level()
level(
entity):number|undefined
Defined in: commands/src/matching.ts:34
The player's experience level, which level= ranges over.
Parameters
entity
Returns
number | undefined
score()
score(
entity,objective):number|undefined
Defined in: commands/src/matching.ts:38
One score of one objective, which scores={...} ranges over.
Parameters
entity
objective
string
Returns
number | undefined
tags()
tags(
entity): readonlystring[]
Defined in: commands/src/matching.ts:36
The entity's tag= set.
Parameters
entity
Returns
readonly string[]
SelectorItemTest
Defined in: commands/src/selector.ts:69
A hasitem={...} entry, Bedrock only. Every field is optional but item.
Properties
data?
readonlyoptionaldata?:number
Defined in: commands/src/selector.ts:71
item
readonlyitem:string
Defined in: commands/src/selector.ts:70
location?
readonlyoptionallocation?:string
Defined in: commands/src/selector.ts:73
negated
readonlynegated:boolean
Defined in: commands/src/selector.ts:75
quantity?
readonlyoptionalquantity?:SelectorRange
Defined in: commands/src/selector.ts:72
slot?
readonlyoptionalslot?:SelectorRange
Defined in: commands/src/selector.ts:74
SelectorModel
Defined in: commands/src/selector.ts:93
One parsed target selector, in whichever dialect it arrived.
Every field is normalized onto the Java spelling, because the Java grammar is the wider of the two. The Bedrock-only arguments keep their own fields because Java has nothing to normalize them onto.
Properties
advancements
readonlyadvancements: readonlySelectorAdvancementTest[]
Defined in: commands/src/selector.ts:128
Java advancements.
base
readonlybase:SelectorBase
Defined in: commands/src/selector.ts:94
dialect
readonlydialect:SelectorDialect
Defined in: commands/src/selector.ts:95
distance?
readonlyoptionaldistance?:SelectorRange
Defined in: commands/src/selector.ts:105
Java distance, Bedrock r and rm.
dx?
readonlyoptionaldx?:number
Defined in: commands/src/selector.ts:101
dy?
readonlyoptionaldy?:number
Defined in: commands/src/selector.ts:102
dz?
readonlyoptionaldz?:number
Defined in: commands/src/selector.ts:103
family
readonlyfamily: readonlySelectorTest<string>[]
Defined in: commands/src/selector.ts:130
Bedrock family, a minecraft:type_family component value.
gamemode
readonlygamemode: readonlySelectorTest<string>[]
Defined in: commands/src/selector.ts:116
hasItem
readonlyhasItem: readonlySelectorItemTest[]
Defined in: commands/src/selector.ts:132
Bedrock hasitem.
hasPermission
readonlyhasPermission:Readonly<Record<string,string>>
Defined in: commands/src/selector.ts:134
Bedrock haspermission, a map of permission name to enabled or disabled.
hasProperty
readonlyhasProperty: readonlySelectorPropertyTest[]
Defined in: commands/src/selector.ts:136
Bedrock has_property.
level?
readonlyoptionallevel?:SelectorRange
Defined in: commands/src/selector.ts:107
Java level, Bedrock l and lm. Players only.
limit?
readonlyoptionallimit?:number
Defined in: commands/src/selector.ts:113
Java limit, the magnitude of Bedrock's c.
literal?
readonlyoptionalliteral?:string
Defined in: commands/src/selector.ts:97
The player name or UUID the string named instead of a base selector.
name
readonlyname: readonlySelectorTest<string>[]
Defined in: commands/src/selector.ts:117
nbt
readonlynbt: readonlySelectorTest<string>[]
Defined in: commands/src/selector.ts:124
Java nbt, an SNBT compound kept as source text.
predicate
readonlypredicate: readonlySelectorTest<string>[]
Defined in: commands/src/selector.ts:126
Java predicate, a datapack predicate id.
scores
readonlyscores: readonlySelectorScoreTest[]
Defined in: commands/src/selector.ts:120
sort?
readonlyoptionalsort?:SelectorSort
Defined in: commands/src/selector.ts:115
Java sort. A negative Bedrock c means furthest.
tag
readonlytag: readonlySelectorTest<string>[]
Defined in: commands/src/selector.ts:119
team
readonlyteam: readonlySelectorTest<string>[]
Defined in: commands/src/selector.ts:122
Java team. Bedrock has no teams.
type
readonlytype: readonlySelectorTest<string>[]
Defined in: commands/src/selector.ts:118
x?
readonlyoptionalx?:SelectorCoordinate
Defined in: commands/src/selector.ts:98
xRotation?
readonlyoptionalxRotation?:SelectorRange
Defined in: commands/src/selector.ts:109
Java x_rotation, Bedrock rx and rxm.
y?
readonlyoptionaly?:SelectorCoordinate
Defined in: commands/src/selector.ts:99
yRotation?
readonlyoptionalyRotation?:SelectorRange
Defined in: commands/src/selector.ts:111
Java y_rotation, Bedrock ry and rym.
z?
readonlyoptionalz?:SelectorCoordinate
Defined in: commands/src/selector.ts:100
SelectorNote
Defined in: commands/src/selector.ts:143
One argument that parsed but does not belong to the dialect it arrived in.
Properties
argument
readonlyargument:string
Defined in: commands/src/selector.ts:145
The argument as it was spelled in the input.
message
readonlymessage:string
Defined in: commands/src/selector.ts:147
reason
readonlyreason:SelectorNoteReason
Defined in: commands/src/selector.ts:146
SelectorParseResult
Defined in: commands/src/selector.ts:151
A parsed selector and everything the parser wants the caller to know about it.
Properties
notes
readonlynotes: readonlySelectorNote[]
Defined in: commands/src/selector.ts:154
Arguments from the other edition's grammar, in the order they appeared.
selector
readonlyselector:SelectorModel
Defined in: commands/src/selector.ts:152
SelectorPropertyTest
Defined in: commands/src/selector.ts:79
A has_property={...} entry, Bedrock only.
Properties
negated
readonlynegated:boolean
Defined in: commands/src/selector.ts:83
property
readonlyproperty:string
Defined in: commands/src/selector.ts:80
value?
readonlyoptionalvalue?:string
Defined in: commands/src/selector.ts:82
The required value, absent when the test only asks whether the property exists.
SelectorRange
Defined in: commands/src/selector.ts:34
An inclusive numeric range. Both bounds are optional, as in a.., ..b and a.
Properties
max?
readonlyoptionalmax?:number
Defined in: commands/src/selector.ts:36
min?
readonlyoptionalmin?:number
Defined in: commands/src/selector.ts:35
SelectorScoreTest
Defined in: commands/src/selector.ts:53
A scores={obj=range} entry. Bedrock also allows ! inside the object.
Properties
negated
readonlynegated:boolean
Defined in: commands/src/selector.ts:56
objective
readonlyobjective:string
Defined in: commands/src/selector.ts:54
range
readonlyrange:SelectorRange
Defined in: commands/src/selector.ts:55
SelectorTest
Defined in: commands/src/selector.ts:47
One value test. negated is the ! prefix, which both editions allow on most arguments.
Type Parameters
T
T
Properties
negated
readonlynegated:boolean
Defined in: commands/src/selector.ts:49
value
readonlyvalue:T
Defined in: commands/src/selector.ts:48
ServerCommandHost
Defined in: commands/src/host.ts:475
The administrative verbs a command needs.
Properties
ticking
readonlyticking:TickCommandHost
Defined in: commands/src/host.ts:482
Methods
addOperator()
addOperator(
player):boolean
Defined in: commands/src/host.ts:476
Parameters
player
Returns
boolean
kick()
kick(
player,reason):boolean
Defined in: commands/src/host.ts:478
Parameters
player
reason
string
Returns
boolean
listPlayers()
listPlayers(): readonly
EntityRef[]
Defined in: commands/src/host.ts:479
Returns
readonly EntityRef[]
playAnimation()
playAnimation(
entities,request):number
Defined in: commands/src/host.ts:508
Plays a one-off animation on entities.
Parameters
entities
readonly EntityRef[]
request
Returns
number
How many entities were asked to play it.
recipes()
recipes(
players,recipe,give):number
Defined in: commands/src/host.ts:485
Unlocks or locks recipes for players.
Parameters
players
readonly EntityRef[]
recipe
string
give
boolean
Returns
number
reload()
reload():
void
Defined in: commands/src/host.ts:481
Returns
void
removeOperator()
removeOperator(
player):boolean
Defined in: commands/src/host.ts:477
Parameters
player
Returns
boolean
sendMessage()
sendMessage(
targets,kind,text):void
Defined in: commands/src/host.ts:487
Sends chat text. kind picks the message form the client renders.
Parameters
targets
readonly EntityRef[]
kind
"chat" | "whisper" | "emote" | "raw"
text
string
Returns
void
sendTitle()
sendTitle(
targets,title):void
Defined in: commands/src/host.ts:489
Sends a title, subtitle, action bar, clear, reset or timing change.
Parameters
targets
readonly EntityRef[]
title
Returns
void
setFog()
setFog(
players,change):number
Defined in: commands/src/host.ts:502
Changes the players' fog stack.
Parameters
players
readonly EntityRef[]
change
Returns
number
How many stacks changed; a pop of a layer nobody pushed changes none.
shakeCamera()
shakeCamera(
players,shake):number
Defined in: commands/src/host.ts:495
Shakes the players' cameras.
Parameters
players
readonly EntityRef[]
shake
Returns
number
How many players were shaken.
stop()
stop():
void
Defined in: commands/src/host.ts:480
Returns
void
transfer()
transfer(
player,host,port):boolean
Defined in: commands/src/host.ts:483
Parameters
player
host
string
port
number
Returns
boolean
usage()
usage(
target?): readonlystring[]
Defined in: commands/src/host.ts:515
Builds the paged list or command-route help /help prints.
Parameters
target?
string
A page number or command route, or undefined for page 1.
Returns
readonly string[]
The formatted help lines.
TestCommandHostOverrides
Defined in: commands/src/testing.ts:22
Per-group overrides for testCommandHost.
Properties
data?
readonlyoptionaldata?:Partial<DataCommandHost>
Defined in: commands/src/testing.ts:26
entities?
readonlyoptionalentities?:Partial<EntityCommandHost>
Defined in: commands/src/testing.ts:23
scoreboard?
readonlyoptionalscoreboard?:Partial<ScoreboardCommandHost>
Defined in: commands/src/testing.ts:25
server?
readonlyoptionalserver?:Partial<ServerCommandHost>
Defined in: commands/src/testing.ts:27
world?
readonlyoptionalworld?:Partial<WorldCommandHost>
Defined in: commands/src/testing.ts:24
TickCommandHost
Defined in: commands/src/host.ts:455
What /tick asks of the tick loop.
Methods
frozen()
frozen():
boolean
Defined in: commands/src/host.ts:463
Returns
boolean
measuredRate()
measuredRate():
number
Defined in: commands/src/host.ts:462
The measured ticks per second.
Returns
number
rate()
rate():
number
Defined in: commands/src/host.ts:457
The ticks per second the loop aims for.
Returns
number
setFrozen()
setFrozen(
frozen):void
Defined in: commands/src/host.ts:464
Parameters
frozen
boolean
Returns
void
setRate()
setRate(
rate):void
Defined in: commands/src/host.ts:458
Parameters
rate
number
Returns
void
sprint()
sprint(
ticks):void
Defined in: commands/src/host.ts:469
Parameters
ticks
number
Returns
void
step()
step(
ticks):boolean
Defined in: commands/src/host.ts:466
Parameters
ticks
number
Returns
boolean
False when the world is not frozen.
stopSprint()
stopSprint():
boolean
Defined in: commands/src/host.ts:471
Returns
boolean
False when no sprint was running.
stopStep()
stopStep():
boolean
Defined in: commands/src/host.ts:468
Returns
boolean
False when no step was running.
tickMs()
tickMs():
number
Defined in: commands/src/host.ts:460
How long a tick's work has been taking, in milliseconds, averaged over recent ticks.
Returns
number
Vector3
Defined in: commands/src/host.ts:19
A position in a dimension.
Properties
x
readonlyx:number
Defined in: commands/src/host.ts:20
y
readonlyy:number
Defined in: commands/src/host.ts:21
z
readonlyz:number
Defined in: commands/src/host.ts:22
WorldCommandHost
Defined in: commands/src/host.ts:168
The world-side verbs a command needs.
Methods
addTime()
addTime(
ticks):number
Defined in: commands/src/host.ts:194
Parameters
ticks
number
Returns
number
clone()
clone(
dimension,begin,end,destination,maskMode,mode,filter?):number
Defined in: commands/src/host.ts:181
Parameters
dimension
string
begin
end
destination
maskMode
mode
filter?
Returns
number
How many blocks were copied.
compareRegions()
compareRegions(
dimension,begin,end,destination,masked):number
Defined in: commands/src/host.ts:191
Parameters
dimension
string
begin
end
destination
masked
boolean
Returns
number
How many blocks of the region match the other region.
dimensions()
dimensions(): readonly
string[]
Defined in: commands/src/host.ts:237
The dimensions /execute in and /teleport accept.
Returns
readonly string[]
fill()
fill(
dimension,from,to,block,mode,filter?):number
Defined in: commands/src/host.ts:172
Parameters
dimension
string
from
to
block
mode
filter?
Returns
number
How many blocks changed.
getBiome()
getBiome(
dimension,position):string|undefined
Defined in: commands/src/host.ts:233
The biome id execute if biome compares.
Parameters
dimension
string
position
Returns
string | undefined
getBlock()
getBlock(
dimension,position):BlockRef|undefined
Defined in: commands/src/host.ts:169
Parameters
dimension
string
position
Returns
BlockRef | undefined
getDifficulty()
getDifficulty():
string
Defined in: commands/src/host.ts:199
Returns
string
getGameRule()
getGameRule(
name):string|number|boolean|undefined
Defined in: commands/src/host.ts:197
Parameters
name
string
Returns
string | number | boolean | undefined
getTime()
getTime():
number
Defined in: commands/src/host.ts:192
Returns
number
getWeather()
getWeather():
"clear"|"rain"|"thunder"
Defined in: commands/src/host.ts:195
Returns
"clear" | "rain" | "thunder"
heightmap()
heightmap(
dimension,position,kind):number
Defined in: commands/src/host.ts:231
The heightmap value execute positioned over reads.
Parameters
dimension
string
position
kind
string
Returns
number
isLoaded()
isLoaded(
dimension,position):boolean
Defined in: commands/src/host.ts:235
Whether the chunk at the position is loaded, for execute if loaded.
Parameters
dimension
string
position
Returns
boolean
locate()
locate(
kind,name,origin,dimension):Vector3|undefined
Defined in: commands/src/host.ts:210
The nearest structure, biome or point of interest by name, for /locate.
Parameters
kind
"structure" | "poi" | "biome"
name
string
What was typed: an id with or without its namespace, or a #tag.
origin
dimension
string
Returns
Vector3 | undefined
The nearest match, or undefined when the search found none. A structure's y is not a height; Java prints it as ~.
locateNames()
locateNames(
kind,dimension): readonlystring[]
Defined in: commands/src/host.ts:215
Every id and #tag a /locate <kind> may name here, offered as suggestions on top of Mojang's published list. Empty for a host with no registry of its own behind the kind.
Parameters
kind
"structure" | "poi" | "biome"
dimension
string
Returns
readonly string[]
particle()
particle(
name,position,dimension,parameters?):boolean
Defined in: commands/src/host.ts:218
Parameters
name
string
position
dimension
string
parameters?
string
Returns
boolean
place()
place(
kind,name,position,dimension):boolean
Defined in: commands/src/host.ts:217
Parameters
kind
string
name
string
position
dimension
string
Returns
boolean
Whether the feature, jigsaw, structure or template was placed.
playSound()
playSound(
sound,listeners,position,volume,pitch):number
Defined in: commands/src/host.ts:219
Parameters
sound
string
listeners
readonly EntityRef[]
position
volume
number
pitch
number
Returns
number
setBlock()
setBlock(
dimension,position,block,mode):boolean
Defined in: commands/src/host.ts:170
Parameters
dimension
string
position
block
mode
Returns
boolean
setDifficulty()
setDifficulty(
difficulty):boolean
Defined in: commands/src/host.ts:200
Parameters
difficulty
string
Returns
boolean
setGameRule()
setGameRule(
name,value):boolean
Defined in: commands/src/host.ts:198
Parameters
name
string
value
string | number | boolean
Returns
boolean
setSpawnPoint()
setSpawnPoint(
player,dimension,position,angle):boolean
Defined in: commands/src/host.ts:202
Parameters
player
dimension
string
position
angle
number
Returns
boolean
setTime()
setTime(
ticks):void
Defined in: commands/src/host.ts:193
Parameters
ticks
number
Returns
void
setWeather()
setWeather(
weather,durationTicks?):void
Defined in: commands/src/host.ts:196
Parameters
weather
"clear" | "rain" | "thunder"
durationTicks?
number
Returns
void
setWorldSpawn()
setWorldSpawn(
dimension,position,angle):boolean
Defined in: commands/src/host.ts:201
Parameters
dimension
string
position
angle
number
Returns
boolean
spreadPlayers()
spreadPlayers(
dimension,center,spreadDistance,maxRange,respectTeams,targets):number
Defined in: commands/src/host.ts:222
Parameters
dimension
string
center
x
number
z
number
spreadDistance
number
maxRange
number
respectTeams
boolean
targets
readonly EntityRef[]
Returns
number
How many players were moved.
stopSound()
stopSound(
listeners,sound?):number
Defined in: commands/src/host.ts:220
Parameters
listeners
readonly EntityRef[]
sound?
string
Returns
number
Type Aliases
BedrockParameterShape
BedrockParameterShape = {
kind:"basic";type:BedrockParameterTypeName; } | {kind:"enum";name:string;values: readonlystring[]; } | {kind:"softEnum";name:string; } | {kind:"postfix";postfix:string; } | {kind:"chained";name:string; }
Defined in: commands/src/parameterTypes.ts:95
What a parameter is on the wire. Everything the flattener produces and everything buildAvailableCommands writes is one of these five.
Union Members
Type Literal
{ kind: "basic"; type: BedrockParameterTypeName; }
A basic type the client parses itself.
Type Literal
{ kind: "enum"; name: string; values: readonly string[]; }
A fixed value list that travels in the packet's enum table.
Type Literal
{ kind: "softEnum"; name: string; }
A value list the server fills later over UpdateSoftEnumPacket.
Type Literal
{ kind: "postfix"; postfix: string; }
An integer with a unit suffix, indexing the packet's postfix table.
Type Literal
{ kind: "chained"; name: string; }
The trailing "and then another subcommand" parameter of a chained overload.
BedrockParameterTypeName
BedrockParameterTypeName = keyof typeof
BedrockParameterTypeId
Defined in: commands/src/parameterTypes.ts:78
A basic parameter type name that has an id of its own.
BlockPlacementMode
BlockPlacementMode =
"replace"|"keep"|"destroy"|"hollow"|"outline"
Defined in: commands/src/host.ts:57
The three ways /setblock and /fill treat what is already there.
CloneMaskMode
CloneMaskMode =
"replace"|"masked"|"filtered"
Defined in: commands/src/host.ts:60
The two ways /clone picks which blocks to copy.
CloneMode
CloneMode =
"normal"|"force"|"move"
Defined in: commands/src/host.ts:63
The three ways /clone treats the source region.
CommandMetadataInput
CommandMetadataInput =
Partial<CommandMetadata>
Defined in: commands/src/tree.ts:38
What CommandRegistry.register needs; everything but the name has a default.
CompareOperator
CompareOperator = typeof
COMPARE_OPERATORS[number]
Defined in: commands/src/argumentTypes.ts:87
One score comparison.
Context
Context =
CommandContext<CommandSource>
Defined in: commands/src/commands/support.ts:135
A Brigadier context over this package's source type.
CoordinateMode
CoordinateMode =
"absolute"|"relative"|"local"
Defined in: commands/src/argumentTypes.ts:60
How a coordinate is measured. ~ is relative, ^ is local to the facing direction.
CoordinateTriple
CoordinateTriple = readonly [
Coordinate,Coordinate,Coordinate]
Defined in: commands/src/argumentTypes.ts:69
The three coordinates of a block_pos, vec3 or rotation argument.
DataModifyOperation
DataModifyOperation =
"append"|"insert"|"merge"|"prepend"|"set"
Defined in: commands/src/host.ts:72
The five /data modify operations.
DataTarget
DataTarget = {
dimension:string;kind:"block";position:Vector3; } | {entity:EntityRef;kind:"entity"; } | {id:string;kind:"storage"; }
Defined in: commands/src/host.ts:66
Where /data and execute if data read from.
EntityAnchor
EntityAnchor =
"eyes"|"feet"
Defined in: commands/src/host.ts:32
Which point of an entity a command measures from.
EntityRelation
EntityRelation =
"attacker"|"controller"|"leasher"|"origin"|"owner"|"passengers"|"target"|"vehicle"
Defined in: commands/src/host.ts:98
The entity relationships execute on walks.
FlattenReason
FlattenReason =
"untyped-argument"|"no-bedrock-type"|"redirect-cycle"|"redirect-to-root"|"fork"|"self-child"|"overload-limit"
Defined in: commands/src/flatten.ts:38
Why the flattener wants the caller to know about a node.
FlattenSeverity
FlattenSeverity =
"degraded"|"dropped"
Defined in: commands/src/flatten.ts:55
How much of the node survived.
FogChange
FogChange = {
fogId:string;mode:"push";userId:string; } | {mode:"pop"|"remove";userId:string; }
Defined in: commands/src/host.ts:441
One change to a player's fog stack, as /fog makes it.
The packet carries the whole stack, so the server is the thing that remembers it; userId is the name a later pop or remove refers to the layer by.
GameRuleType
GameRuleType =
"boolean"|"integer"
Defined in: commands/src/gamerules.ts:32
What a gamerule's value is.
LootDestination
LootDestination = {
kind:"give";players: readonlyEntityRef[]; } | {dimension:string;kind:"insert";position:Vector3; } | {dimension:string;kind:"spawn";position:Vector3; } | {kind:"replace";slot:ItemSlot;target:DataTarget; }
Defined in: commands/src/host.ts:396
Where /loot puts what a loot table produced.
LootSource
LootSource = {
kind:"table";table:string; } | {dimension:string;kind:"fish";position:Vector3;table:string;tool?:string; } | {entity:EntityRef;kind:"kill"; } | {dimension:string;kind:"mine";position:Vector3;tool?:string; }
Defined in: commands/src/host.ts:373
What /loot rolls.
Java's four sources, and only the first names a table outright. kill rolls the table of the entity it names, mine rolls the table of the block at the position, and fish rolls a named table with the position and tool the fishing conditions read - so a host handed a bare table id could answer only one of the four.
Union Members
Type Literal
{ kind: "table"; table: string; }
loot <table>: the table, rolled with the command's own position as its origin.
Type Literal
{ dimension: string; kind: "fish"; position: Vector3; table: string; tool?: string; }
fish <table> <pos> [<tool>]: a named table with a position and a tool.
dimension
readonlydimension:string
kind
readonlykind:"fish"
position
readonlyposition:Vector3
table
readonlytable:string
tool?
readonlyoptionaltool?:string
An item id, or mainhand or offhand, which read off the source entity.
Type Literal
{ entity: EntityRef; kind: "kill"; }
kill <target>: whatever that entity would drop if it died now.
Type Literal
{ dimension: string; kind: "mine"; position: Vector3; tool?: string; }
mine <pos> [<tool>]: whatever that block would drop if the tool broke it.
ScoreHolderModel
ScoreHolderModel = {
kind:"selector";selector:SelectorModel; } | {kind:"name";name:string; } | {kind:"all"; }
Defined in: commands/src/argumentTypes.ts:164
Who a score belongs to, which is Java's ScoreHolderArgument.
Not an entity. A scoreboard scores a name, and a name no entity has - a "fake player" - is the normal way a datapack keeps a counter that is not about anybody. So the three forms are a selector, a bare name, and *, which means every holder the scoreboard already tracks.
ScoreboardOperation
ScoreboardOperation = typeof
SCOREBOARD_OPERATIONS[number]
Defined in: commands/src/argumentTypes.ts:81
One scoreboard operation.
SelectorBase
SelectorBase =
"@p"|"@a"|"@r"|"@e"|"@s"|"@n"|"@initiator"
Defined in: commands/src/selector.ts:28
The base selectors. Java has the first six; Bedrock adds @initiator.
SelectorDialect
SelectorDialect =
"java"|"bedrock"
Defined in: commands/src/selector.ts:25
Which edition's grammar a selector string is written in.
SelectorNoteReason
SelectorNoteReason =
"java-only"|"bedrock-only"|"no-counterpart"
Defined in: commands/src/selector.ts:140
Why a parsed argument is worth telling the caller about.
SelectorSort
SelectorSort =
"nearest"|"furthest"|"random"|"arbitrary"
Defined in: commands/src/selector.ts:31
How a selector orders its candidates before limit cuts the list.
StoreTarget
StoreTarget = {
dimension:string;kind:"block";path:string;position:Vector3; } | {entity:EntityRef;kind:"entity";path:string; } | {id:string;kind:"storage";path:string; } | {holder:string;kind:"score";objective:string; } | {field:"value"|"max";id:string;kind:"bossbar"; }
Defined in: commands/src/host.ts:90
What execute store writes a result into.
SuggestionProvider
SuggestionProvider<
S> =Parameters<RequiredArgumentBuilder<S,unknown>["suggests"]>[0]
Defined in: commands/src/suggestions.ts:4
The provider shape RequiredArgumentBuilder.suggests accepts, named so exported providers can carry it.
Type Parameters
S
S
TimeUnit
TimeUnit = keyof typeof
TIME_UNIT_TICKS
Defined in: commands/src/argumentTypes.ts:230
A unit suffix a time argument accepts.
TitleInstruction
TitleInstruction = {
kind:"title"|"subtitle"|"actionbar";raw?:boolean;text:string; } | {kind:"clear"|"reset"; } | {fadeIn:number;fadeOut:number;kind:"times";stay:number; }
Defined in: commands/src/host.ts:411
What one /title or /titleraw line asks the client to draw.
One model rather than a text argument and a flag, because the three forms carry different data: a slot takes text, clear and reset take none, and times takes three durations and no text at all. Spelling them as one string with ignored parameters is how a times call silently becomes a title reading "20".
Union Members
Type Literal
{ kind: "title" | "subtitle" | "actionbar"; raw?: boolean; text: string; }
kind
readonlykind:"title"|"subtitle"|"actionbar"
raw?
readonlyoptionalraw?:boolean
True when text is a rawtext JSON object, as /titleraw sends.
text
readonlytext:string
Type Literal
{ kind: "clear" | "reset"; }
Type Literal
{ fadeIn: number; fadeOut: number; kind: "times"; stay: number; }
Variables
ATTRIBUTE_OPERATIONS
constATTRIBUTE_OPERATIONS: readonly ["add_value","add_multiplied_base","add_multiplied_total"]
Defined in: commands/src/commands/entities.ts:40
The three attribute modifier operations Java 26.3 accepts.
BEDROCK_BASE_SELECTORS
constBEDROCK_BASE_SELECTORS: readonlySelectorBase[]
Defined in: commands/src/selector.ts:173
The seven base selectors Bedrock accepts, Java's six plus @initiator.
BEDROCK_ONLY_COMMAND_NAMES
constBEDROCK_ONLY_COMMAND_NAMES: readonlystring[]
Defined in: commands/src/commands/vanilla.ts:89
The Bedrock commands Java has no counterpart for that this package implements, from Bedrock's other 38.
Four are older spellings of something Java says differently and run the same host verbs as the Java form; the rest are Bedrock's own. See registerBedrockCommands for why these and not the other 29.
BEDROCK_ONLY_SELECTOR_ARGUMENTS
constBEDROCK_ONLY_SELECTOR_ARGUMENTS: readonlystring[]
Defined in: commands/src/selector.ts:236
The Bedrock arguments with no Java expression.
BEDROCK_SELECTOR_ARGUMENTS
constBEDROCK_SELECTOR_ARGUMENTS: readonlystring[]
Defined in: commands/src/selector.ts:201
The selector arguments Bedrock accepts.
BLOCK_EQUIPMENT_SLOTS
constBLOCK_EQUIPMENT_SLOTS: readonly ["slot.container"]
Defined in: commands/src/commands/bedrock.ts:82
The slots /replaceitem block addresses, as Mojang's BlockEquipmentSlot enum lists them.
One value, and that is the whole enum. Whatever a block stores - a chest's 27, a furnace's three, a hopper's five - the client names the group slot.container and tells the slots apart by index.
BedrockParameterTypeId
constBedrockParameterTypeId:object
Defined in: commands/src/parameterTypes.ts:53
The basic parameter type ids, keyed by the name Mojang's command metadata spells.
Mojang's table declares 26 basic parameter type names and 21 of them are below, which is not a gap. The other five, EXECUTECHAINEDOPTION_0 and the four POSTFIX_* names, carry no id of their own: a chained subcommand indexes the packet's chained-subcommand table and a postfix indexes its postfix table, and BedrockParameterShape gives each its own kind. 21 + 1 + 4 is the 26.
Type Declaration
BLOCK_STATE_ARRAY
readonlyBLOCK_STATE_ARRAY:84=84
CLOCK_TIMEMARKER_NAME
readonlyCLOCK_TIMEMARKER_NAME:86=86
CODEBUILDERARGS
readonlyCODEBUILDERARGS:92=92
COMPAREOPERATOR
readonlyCOMPAREOPERATOR:7=7
FULLINTEGERRANGE
readonlyFULLINTEGERRANGE:23=23
ID
readonlyID:56=56
INT
readonlyINT:1=1
JSON_OBJECT
readonlyJSON_OBJECT:74=74
MESSAGE_ROOT
readonlyMESSAGE_ROOT:68=68
OPERATOR
readonlyOPERATOR:6=6
PATHCOMMAND
readonlyPATHCOMMAND:17=17
POI_TAG
readonlyPOI_TAG:87=87
POI_TYPE
readonlyPOI_TYPE:88=88
POSITION
readonlyPOSITION:64=64
POSITION_FLOAT
readonlyPOSITION_FLOAT:65=65
RAWTEXT
readonlyRAWTEXT:70=70
RVAL
readonlyRVAL:4=4
SELECTION
readonlySELECTION:8=8
VAL
readonlyVAL:3=3
WILDCARDINT
readonlyWILDCARDINT:5=5
WILDCARDSELECTION
readonlyWILDCARDSELECTION:10=10
CHAINED_SUBCOMMAND_TYPE
constCHAINED_SUBCOMMAND_TYPE:"EXECUTECHAINEDOPTION_0"='EXECUTECHAINEDOPTION_0'
Defined in: commands/src/parameterTypes.ts:89
The metadata name of the chained-subcommand parameter type, Mojang's only one.
COMPARE_OPERATORS
constCOMPARE_OPERATORS: readonly ["<","<=","=",">=",">"]
Defined in: commands/src/argumentTypes.ts:84
The comparisons execute if score accepts.
DATA_MODIFY_OPERATIONS
constDATA_MODIFY_OPERATIONS: readonlyDataModifyOperation[]
Defined in: commands/src/commands/data.ts:57
The five /data modify operations.
ENTITY_EQUIPMENT_SLOTS
constENTITY_EQUIPMENT_SLOTS: readonly ["slot.weapon.mainhand","slot.weapon.offhand","slot.armor.head","slot.armor.chest","slot.armor.legs","slot.armor.feet","slot.armor.body","slot.hotbar","slot.inventory","slot.enderchest","slot.saddle","slot.armor","slot.chest","slot.equippable"]
Defined in: commands/src/commands/bedrock.ts:57
The slots /replaceitem entity addresses, as Mojang's EntityEquipmentSlot enum lists them.
EXECUTE_CONDITIONS
constEXECUTE_CONDITIONS: readonlystring[]
Defined in: commands/src/commands/execute.ts:73
The 13 conditions execute if and execute unless accept.
EXECUTE_ON_RELATIONS
constEXECUTE_ON_RELATIONS: readonlyEntityRelation[]
Defined in: commands/src/commands/execute.ts:61
The eight relationships execute on walks.
EXECUTE_STORE_TARGETS
constEXECUTE_STORE_TARGETS: readonlystring[]
Defined in: commands/src/commands/execute.ts:90
The five things execute store writes into.
EXECUTE_SUBCOMMANDS
constEXECUTE_SUBCOMMANDS: readonlystring[]
Defined in: commands/src/commands/execute.ts:93
The 14 subcommands of /execute.
FAILED
constFAILED:0=0
Defined in: commands/src/commands/support.ts:22
The command result Brigadier treats as "did nothing".
JAVA_BASE_SELECTORS
constJAVA_BASE_SELECTORS: readonlySelectorBase[]
Defined in: commands/src/selector.ts:170
The six base selectors Java's EntitySelectorParser declares.
JAVA_GAME_RULES
constJAVA_GAME_RULES: readonlyGameRule[]
Defined in: commands/src/gamerules.ts:131
The 59 gamerules of the 26.3 minecraft:game_rule registry, sorted by id.
JAVA_ONLY_COMMAND_NAMES
constJAVA_ONLY_COMMAND_NAMES: readonlystring[]
Defined in: commands/src/commands/vanilla.ts:79
The Java-only commands this package implements because the datapack runtime cannot work without them. Bedrock has no parameter type for most of their arguments, so the flattener degrades those to a string and says so.
JAVA_ONLY_SELECTOR_ARGUMENTS
constJAVA_ONLY_SELECTOR_ARGUMENTS: readonlystring[]
Defined in: commands/src/selector.ts:233
The Java arguments with no Bedrock expression at all, from the research note's gap table. sort=arbitrary is a fourth gap, but it is a value rather than an argument, so it is not listed here.
JAVA_SELECTOR_ARGUMENTS
constJAVA_SELECTOR_ARGUMENTS: readonlystring[]
Defined in: commands/src/selector.ts:176
The 21 selector arguments Java's EntitySelectorOptions names.
LOOT_DESTINATIONS
constLOOT_DESTINATIONS: readonly ["give","insert","spawn","replace"]
Defined in: commands/src/commands/data.ts:60
The four /loot destinations crossed with the four sources Java defines.
ParameterOption
constParameterOption:object
Defined in: commands/src/parameterTypes.ts:35
The Options byte of a parameter, CommandParameterOption in Mojang's own naming. EnumAsChainedCommand marks the trailing parameter of a chained /execute overload.
Type Declaration
EnumAsChainedCommand
readonlyEnumAsChainedCommand:4=4
EnumAutocompleteExpansion
readonlyEnumAutocompleteExpansion:1=1
HasSemanticConstraint
readonlyHasSemanticConstraint:2=2
None
readonlyNone:0=0
ParameterTypeFlag
constParameterTypeFlag:object
Defined in: commands/src/parameterTypes.ts:23
The flag bits of a parameter's type word.
A basic type is its id with Valid set. An enum parameter carries Enum (or SoftEnum) with Valid and the enum's index in its own table. A postfixed integer carries Postfix and the postfix's index, and is the one case with no Valid bit.
Type Declaration
Enum
readonlyEnum:2097152=0x200000
Postfix
readonlyPostfix:16777216=0x1000000
SoftEnum
readonlySoftEnum:67108864=0x4000000
Valid
readonlyValid:1048576=0x100000
PostfixParameterType
constPostfixParameterType:object
Defined in: commands/src/parameterTypes.ts:81
The postfix a POSTFIX_* parameter type writes into the packet's postfix table.
Type Declaration
POSTFIX_D
readonlyPOSTFIX_D:"d"='d'
POSTFIX_L
readonlyPOSTFIX_L:"l"='l'
POSTFIX_S
readonlyPOSTFIX_S:"s"='s'
POSTFIX_T
readonlyPOSTFIX_T:"t"='t'
REMOVED_GAME_RULES
constREMOVED_GAME_RULES: readonlystring[]
Defined in: commands/src/gamerules.ts:147
The three rules 1.21.11 removed rather than renamed, from the removal branch of GameRuleRegistryFix.
SCOREBOARD_OPERATIONS
constSCOREBOARD_OPERATIONS: readonly ["=","+=","-=","*=","/=","%=","<",">","><"]
Defined in: commands/src/argumentTypes.ts:78
The scoreboard operations /scoreboard players operation accepts.
SHARED_COMMAND_NAMES
constSHARED_COMMAND_NAMES: readonlystring[]
Defined in: commands/src/commands/vanilla.ts:25
The 46 command names Java 26.3 and Bedrock 1.26.50 both have, from the research note's comparison of Mojang's two command sets.
STRING_FALLBACK
constSTRING_FALLBACK:BedrockParameterShape
Defined in: commands/src/parameterTypes.ts:108
The string every argument the 26 types cannot express falls back to.
SUCCESS
constSUCCESS:1=1
Defined in: commands/src/commands/support.ts:25
The command result a success with nothing to count reports.
TIME_UNIT_TICKS
constTIME_UNIT_TICKS:object
Defined in: commands/src/argumentTypes.ts:227
How many ticks each unit Java's minecraft:time accepts is worth.
l is missing on purpose: Bedrock's fourth postfix spells experience levels, not a duration.
Type Declaration
d
readonlyd:24000=24_000
s
readonlys:20=20
t
readonlyt:1=1
bedrockBasicTypeNames
constbedrockBasicTypeNames: readonlystring[]
Defined in: commands/src/parameterTypes.ts:148
The 26 basic parameter type names Mojang's own command set uses, read from the generated table rather than repeated here.
bedrockCommandTable
constbedrockCommandTable:BedrockCommandTable=table
Defined in: commands/src/bedrockTable.ts:85
Mojang's Bedrock command set, as published for the pinned game version.
dimensionSuggestions
constdimensionSuggestions:SuggestionProvider<CommandSource>
Defined in: commands/src/commands/support.ts:198
Suggests the dimensions the host has, Java ids included.
Functions
anchorArgument()
anchorArgument():
BedrockDescribedType<"eyes"|"feet">
Defined in: commands/src/commands/support.ts:207
The two anchors execute anchored and execute facing entity accept.
Returns
BedrockDescribedType<"eyes" | "feet">
arg()
arg<
T>(name,type):RequiredArgumentBuilder<CommandSource,T>
Defined in: commands/src/commands/support.ts:141
argument, with the source type already bound.
Type Parameters
T
T
Parameters
name
string
type
ArgumentType<T>
Returns
RequiredArgumentBuilder<CommandSource, T>
basicParseSymbol()
basicParseSymbol(
type):number
Defined in: commands/src/parameterTypes.ts:115
Builds the Parse Symbol word of a basic parameter.
Parameters
type
"SELECTION" | "VAL" | "INT" | "ID" | "POSITION_FLOAT" | "POSITION" | "RVAL" | "PATHCOMMAND" | "WILDCARDSELECTION" | "BLOCK_STATE_ARRAY" | "JSON_OBJECT" | "MESSAGE_ROOT" | "WILDCARDINT" | "CLOCK_TIMEMARKER_NAME" | "CODEBUILDERARGS" | "COMPAREOPERATOR" | "FULLINTEGERRANGE" | "OPERATOR" | "POI_TAG" | "POI_TYPE" | "RAWTEXT"
Returns
number
The type id with the Valid bit set.
bedrockCommand()
bedrockCommand(
name):BedrockCommandDefinition|undefined
Defined in: commands/src/bedrockTable.ts:97
Looks a command up by the name a player types, without a leading slash.
Parameters
name
string
Returns
BedrockCommandDefinition | undefined
The command, or undefined when Bedrock has no command by that name.
bedrockCommandEnum()
bedrockCommandEnum(
name):BedrockCommandEnum|undefined
Defined in: commands/src/bedrockTable.ts:107
Looks a command enum up by the name a parameter refers to it by.
Parameters spell the name in upper case and the declaration does not, so the lookup is case-insensitive.
Parameters
name
string
Returns
BedrockCommandEnum | undefined
The enum, or undefined when the name is a basic type or unknown.
bedrockGameRuleNames()
bedrockGameRuleNames():
object
Defined in: commands/src/gamerules.ts:191
Bedrock's own gamerule names, read from the /gamerule enums of Mojang's command metadata rather than repeated here.
Returns
object
The boolean names and the integer names, in Mojang's order.
boolean
boolean: readonly
string[]
integer
integer: readonly
string[]
bedrockOnlyGameRuleNames()
bedrockOnlyGameRuleNames(): readonly
string[]
Defined in: commands/src/gamerules.ts:197
The Bedrock gamerules with no rule of the same meaning in Java's registry.
Returns
readonly string[]
blockPositionArgument()
blockPositionArgument():
BedrockDescribedType<CoordinateTriple>
Defined in: commands/src/argumentTypes.ts:195
A block position, three integer-or-relative coordinates.
Returns
BedrockDescribedType<CoordinateTriple>
blockStatesArgument()
blockStatesArgument():
BedrockDescribedType<string>
Defined in: commands/src/argumentTypes.ts:308
A ["name"="value"] block state list, the BLOCK_STATE_ARRAY type.
The leading bracket is required, and that is what keeps /setblock and /fill unambiguous. Mojang's own grammar gives each of them two overloads, <block> <states> [mode] and <block> [mode], which only tell apart because a state list cannot be spelled as a bare word: reading any token here made /setblock 1 2 3 dirt keep parse keep as an empty state list and place the block in replace mode.
Returns
BedrockDescribedType<string>
buildAvailableCommands()
buildAvailableCommands<
S>(registry,options?):BuildAvailableCommandsResult
Defined in: commands/src/packet.ts:163
Builds the AvailableCommandsPacket payload from a command registry.
Pass source to filter the tree by CommandNode.canUse the way Java does, so a player is only told about the commands they may run.
Type Parameters
S
S
Parameters
registry
The tree to send.
options?
BuildAvailableCommandsOptions<S> = {}
Returns
The payload and the flattener's report. Callers that care about fidelity should log or assert on the notes; nothing is dropped silently.
command()
command(
run):Command
Defined in: commands/src/commands/support.ts:167
Wraps a command body for ArgumentBuilder.executes.
The port declares Command<S> as (context) => Promise<any>, where upstream Brigadier returns an int and CommandDispatcher.execute reads the value synchronously and hands it to the ResultConsumer. A number is what the dispatcher wants and what execute store result captures, so the declared type is bridged here once instead of at every command.
Parameters
run
(context) => number
Returns
Command
commandArgument()
commandArgument():
BedrockDescribedType<string>
Defined in: commands/src/argumentTypes.ts:360
The trailing command of execute run, the CODEBUILDERARGS type.
Bedrock's own metadata spells /execute run <command: CODEBUILDERARGS>, so this is the one place the client is told "the rest is another command".
Returns
BedrockDescribedType<string>
compareOperatorArgument()
compareOperatorArgument():
BedrockDescribedType<">"|"<"|"="|"<="|">=">
Defined in: commands/src/argumentTypes.ts:346
A score comparison, the COMPAREOPERATOR type.
Returns
BedrockDescribedType<">" | "<" | "=" | "<=" | ">=">
createCommandSource()
createCommandSource(
input):CommandSource
Defined in: commands/src/host.ts:718
Builds a command source.
Parameters
input
The host is required; the console's origin, zero rotation, the overworld, the feet anchor, permission level 0, not silent and the Java selector grammar are the defaults.
Returns
describesBedrock()
describesBedrock(
type):type is BedrockDescribedType<unknown>
Defined in: commands/src/argumentTypes.ts:38
Whether an argument type can describe itself to a Bedrock client.
An argument type from outside this package cannot, which is the case the flattener reports.
Parameters
type
unknown
Returns
type is BedrockDescribedType<unknown>
dimensionArgument()
dimensionArgument():
BedrockDescribedType<string>
Defined in: commands/src/commands/support.ts:192
A dimension name, for /execute in and execute if dimension.
Any token parses, since dimensions are data-driven and a custom one is only known to the host. toDimensionId turns the token into a Java id and dimensionSuggestions offers the host's dimensions(). The client's Dimension enum holds only the vanilla three.
Returns
BedrockDescribedType<string>
encodeAvailableCommands()
encodeAvailableCommands(
flattened,softEnumValues?):AvailableCommandsPayload
Defined in: commands/src/packet.ts:177
Builds the payload from an already-flattened tree.
Useful when the caller wants to inspect or filter the flattener's report before encoding.
Parameters
flattened
softEnumValues?
Readonly<Record<string, readonly string[]>> = {}
Returns
entityArgument()
entityArgument(
options?):BedrockDescribedType<SelectorModel>
Defined in: commands/src/argumentTypes.ts:141
A target selector.
Parameters
options?
wildcard picks WILDCARDSELECTION, the type Bedrock uses where * is allowed; dialect picks the grammar the string is read in.
dialect?
wildcard?
boolean
Returns
BedrockDescribedType<SelectorModel>
enumArgument()
enumArgument<
T>(name,values):BedrockDescribedType<T>
Defined in: commands/src/argumentTypes.ts:379
A fixed value list, which the packet sends as a hard enum.
Every Bedrock subcommand keyword is one of these, usually with a single value: Mojang's own metadata spells /execute with OPTION_AS = ['as'].
Type Parameters
T
T extends string
Parameters
name
string
The enum name the packet writes, Mojang's spelling where one exists.
values
readonly T[]
Returns
enumParseSymbol()
enumParseSymbol(
index):number
Defined in: commands/src/parameterTypes.ts:123
Builds the Parse Symbol word of a hard enum parameter.
Parameters
index
number
The enum's position in the packet's Enum Data list.
Returns
number
filePathArgument()
filePathArgument():
BedrockDescribedType<string>
Defined in: commands/src/argumentTypes.ts:315
A function path, the PATHCOMMAND type.
Returns
BedrockDescribedType<string>
flattenCommandTree()
flattenCommandTree<
S>(registry,options?):FlattenResult
Defined in: commands/src/flatten.ts:391
Flattens every command in a registry into Bedrock's overload shape.
Type Parameters
S
S
Parameters
registry
The tree to flatten. Aliases fold into their owner's alias list rather than becoming commands of their own.
options?
FlattenOptions<S> = {}
Returns
The flattened commands and one note per node that could not be carried across unchanged.
floatArgument()
floatArgument(
bounds?):BedrockDescribedType<number>
Defined in: commands/src/argumentTypes.ts:204
A decimal, the VAL type.
Parameters
bounds?
max?
number
min?
number
Returns
BedrockDescribedType<number>
gameModeArgument()
gameModeArgument():
BedrockDescribedType<"default"|"creative"|"spectator"|"survival"|"adventure">
Defined in: commands/src/commands/support.ts:203
The five game modes /gamemode accepts, in Mojang's Bedrock spelling.
Returns
BedrockDescribedType<"default" | "creative" | "spectator" | "survival" | "adventure">
gameRule()
gameRule(
name):GameRule|undefined
Defined in: commands/src/gamerules.ts:168
Looks a gamerule up by its 1.21.11 id, its pre-1.21.11 camelCase name, or Bedrock's lowercase name.
A bare id without the namespace resolves too, because that is how a /gamerule line usually spells it.
Parameters
name
string
Returns
GameRule | undefined
The rule, or undefined when the name belongs to no edition.
hasParameterTypeId()
hasParameterTypeId(
name): name is "SELECTION" | "VAL" | "INT" | "ID" | "POSITION_FLOAT" | "POSITION" | "RVAL" | "PATHCOMMAND" | "WILDCARDSELECTION" | "BLOCK_STATE_ARRAY" | "JSON_OBJECT" | "MESSAGE_ROOT" | "WILDCARDINT" | "CLOCK_TIMEMARKER_NAME" | "CODEBUILDERARGS" | "COMPAREOPERATOR" | "FULLINTEGERRANGE" | "OPERATOR" | "POI_TAG" | "POI_TYPE" | "RAWTEXT"
Defined in: commands/src/parameterTypes.ts:156
Whether this package can give the named basic parameter type a wire id.
False for the five that index a packet table instead of carrying an id: the chained-subcommand type and the four postfix types.
Parameters
name
string
Returns
name is "SELECTION" | "VAL" | "INT" | "ID" | "POSITION_FLOAT" | "POSITION" | "RVAL" | "PATHCOMMAND" | "WILDCARDSELECTION" | "BLOCK_STATE_ARRAY" | "JSON_OBJECT" | "MESSAGE_ROOT" | "WILDCARDINT" | "CLOCK_TIMEMARKER_NAME" | "CODEBUILDERARGS" | "COMPAREOPERATOR" | "FULLINTEGERRANGE" | "OPERATOR" | "POI_TAG" | "POI_TYPE" | "RAWTEXT"
integerArgument()
integerArgument(
bounds?):BedrockDescribedType<number>
Defined in: commands/src/argumentTypes.ts:213
An integer, the INT type.
Parameters
bounds?
max?
number
min?
number
Returns
BedrockDescribedType<number>
integerRangeArgument()
integerRangeArgument():
BedrockDescribedType<IntegerRange>
Defined in: commands/src/argumentTypes.ts:318
An a..b, a.., ..b or a integer range, the FULLINTEGERRANGE type.
Returns
BedrockDescribedType<IntegerRange>
isBedrockBasicType()
isBedrockBasicType(
name):boolean
Defined in: commands/src/bedrockTable.ts:113
Whether the name is one of the basic parameter types rather than a command enum.
Parameters
name
string
Returns
boolean
isBedrockSoftEnum()
isBedrockSoftEnum(
name):boolean
Defined in: commands/src/bedrockTable.ts:110
Whether the named enum is one of the four Mojang declares with no values.
Parameters
name
string
Returns
boolean
isRemovedGameRule()
isRemovedGameRule(
legacyName):boolean
Defined in: commands/src/gamerules.ts:183
Whether 1.21.11 removed the named gamerule outright.
Parameters
legacyName
string
Returns
boolean
isTimeUnit()
isTimeUnit(
unit): unit is "d" | "s" | "t"
Defined in: commands/src/argumentTypes.ts:233
Whether a suffix is one of the three units a time argument scales by.
Parameters
unit
string
Returns
unit is "d" | "s" | "t"
itemModifierArgument()
itemModifierArgument():
BedrockDescribedType<string>
Defined in: commands/src/argumentTypes.ts:447
minecraft:loot_modifier, a standalone item modifier file id.
Returns
BedrockDescribedType<string>
jsonArgument()
jsonArgument():
BedrockDescribedType<string>
Defined in: commands/src/argumentTypes.ts:291
A JSON object, the JSON_OBJECT type.
Returns
BedrockDescribedType<string>
lit()
lit(
name):LiteralArgumentBuilder<CommandSource>
Defined in: commands/src/commands/support.ts:138
literal, with the source type already bound.
Parameters
name
string
Returns
LiteralArgumentBuilder<CommandSource>
lootPredicateArgument()
lootPredicateArgument():
BedrockDescribedType<string>
Defined in: commands/src/argumentTypes.ts:451
minecraft:loot_predicate, the argument of execute if predicate.
Returns
BedrockDescribedType<string>
lootTableArgument()
lootTableArgument():
BedrockDescribedType<string>
Defined in: commands/src/argumentTypes.ts:455
minecraft:loot_table, the argument of /loot and execute if items.
Returns
BedrockDescribedType<string>
matchSelector()
matchSelector(
selector,source,options): readonlyEntityRef[]
Defined in: commands/src/matching.ts:182
Resolves one parsed selector against a list of candidates.
@s and @initiator answer the source's own entity and never look at the candidates, which is how Java keeps execute as @e run ... @s cheap and correct inside a fork.
Parameters
selector
A selector from parseSelector, in either dialect.
source
The frame of reference: position for distances, entity for @s.
options
Returns
readonly EntityRef[]
The matches, already sorted and cut to the selector's limit.
messageArgument()
messageArgument():
BedrockDescribedType<string>
Defined in: commands/src/argumentTypes.ts:275
The rest of the line as one string, the MESSAGE_ROOT type.
Returns
BedrockDescribedType<string>
nbtCompoundArgument()
nbtCompoundArgument():
BedrockDescribedType<string>
Defined in: commands/src/argumentTypes.ts:443
minecraft:nbt_compound_tag, an SNBT compound.
Returns
BedrockDescribedType<string>
nbtPathArgument()
nbtPathArgument():
BedrockDescribedType<string>
Defined in: commands/src/argumentTypes.ts:435
minecraft:nbt_path, the second most used parser in Java's tree. Bedrock has no NBT type.
Returns
BedrockDescribedType<string>
nbtTagArgument()
nbtTagArgument():
BedrockDescribedType<string>
Defined in: commands/src/argumentTypes.ts:439
minecraft:nbt_tag, a single SNBT value.
Returns
BedrockDescribedType<string>
operationArgument()
operationArgument():
BedrockDescribedType<">"|"<"|"="|"+="|"-="|"*="|"/="|"%="|"><">
Defined in: commands/src/argumentTypes.ts:337
A scoreboard operation, the OPERATOR type.
Returns
BedrockDescribedType<">" | "<" | "=" | "+=" | "-=" | "*=" | "/=" | "%=" | "><">
parseBlockStates()
parseBlockStates(
text):Record<string,string|number|boolean>
Defined in: commands/src/commands/world.ts:117
Reads Bedrock's ["facing"="north","age"=7] block state list into a typed record.
Parameters
text
string
Returns
Record<string, string | number | boolean>
parseSelector()
parseSelector(
input,dialect):SelectorParseResult
Defined in: commands/src/selector.ts:781
Parses one target selector in the given dialect.
The reader stops at the first character that cannot continue the selector, so a caller parsing a command line can read the rest from result.length.
Parameters
input
string
The selector, starting at @ or at a player name or UUID.
dialect
Which edition's grammar to read, and which arguments to note as belonging to the other one.
Returns
The selector model and the notes the parse produced.
Throws
When the string does not parse in either grammar.
positionArgument()
positionArgument():
BedrockDescribedType<CoordinateTriple>
Defined in: commands/src/argumentTypes.ts:198
A float position, three decimal-or-relative coordinates.
Returns
BedrockDescribedType<CoordinateTriple>
postfixIntegerArgument()
postfixIntegerArgument(
postfix):BedrockDescribedType<number>
Defined in: commands/src/argumentTypes.ts:407
An integer with a unit suffix, which indexes the packet's postfix table.
A postfixed parameter is the one kind with no Valid bit in its type word.
Parameters
postfix
string
The suffix, one of t, s, d or l.
Returns
BedrockDescribedType<number>
postfixParseSymbol()
postfixParseSymbol(
index):number
Defined in: commands/src/parameterTypes.ts:142
Builds the Parse Symbol word of a postfixed integer.
A postfix is the one parameter kind with no Valid bit.
Parameters
index
number
The postfix's position in the packet's Post Fixes list.
Returns
number
rawTextArgument()
rawTextArgument():
BedrockDescribedType<string>
Defined in: commands/src/argumentTypes.ts:283
A rawtext JSON object, the RAWTEXT type.
Returns
BedrockDescribedType<string>
registerBedrockCommands()
registerBedrockCommands(
registry):void
Defined in: commands/src/commands/bedrock.ts:85
Registers the nine Bedrock-only commands.
Parameters
registry
CommandRegistry<CommandSource>
Returns
void
registerDataCommands()
registerDataCommands(
registry):void
Defined in: commands/src/commands/data.ts:86
Registers the seven data-driven commands.
Parameters
registry
CommandRegistry<CommandSource>
Returns
void
registerEntityCommands()
registerEntityCommands(
registry):void
Defined in: commands/src/commands/entities.ts:55
Registers the 13 entity commands.
Parameters
registry
CommandRegistry<CommandSource>
Returns
void
registerExecute()
registerExecute(
registry):LiteralCommandNode<CommandSource>
Defined in: commands/src/commands/execute.ts:117
Builds the /execute tree and registers it.
Parameters
registry
CommandRegistry<CommandSource>
Returns
LiteralCommandNode<CommandSource>
The root node, so a caller can hang more subcommands off it.
registerServerCommands()
registerServerCommands(
registry):void
Defined in: commands/src/commands/server.ts:33
Registers the 14 chat and administration commands.
Parameters
registry
CommandRegistry<CommandSource>
Returns
void
registerTitleRaw()
registerTitleRaw(
registry):void
Defined in: commands/src/commands/server.ts:296
Registers /titleraw, which is /title over a rawtext object.
Parameters
registry
CommandRegistry<CommandSource>
Returns
void
registerVanillaCommands()
registerVanillaCommands(
registry?):CommandRegistry<CommandSource>
Defined in: commands/src/commands/vanilla.ts:110
Builds a registry holding the whole command set.
The dispatcher's ResultConsumer is wired to the execute store sinks, so execute store result score ... run ... captures what the last command returned.
Parameters
registry?
CommandRegistry<CommandSource> = ...
Returns
CommandRegistry<CommandSource>
The registry, ready to dispatch and to flatten into a packet.
registerWorldCommands()
registerWorldCommands(
registry):void
Defined in: commands/src/commands/world.ts:217
Registers the 15 world commands.
Parameters
registry
CommandRegistry<CommandSource>
Returns
void
relativeValueArgument()
relativeValueArgument():
BedrockDescribedType<Coordinate>
Defined in: commands/src/argumentTypes.ts:201
One signed decimal that may be written relative, the RVAL type.
Returns
BedrockDescribedType<Coordinate>
renamedGameRule()
renamedGameRule(
legacyName):string|undefined
Defined in: commands/src/gamerules.ts:180
The 1.21.11 id of a pre-1.21.11 gamerule name.
Parameters
legacyName
string
Returns
string | undefined
The current id, or undefined when the rule was removed or never existed. REMOVED_GAME_RULES names the three removals.
report()
report(
source,count,message):number
Defined in: commands/src/commands/support.ts:176
Reports a count back to the source and returns it as the command result.
A command's return value is what execute store result captures, so it has to be the count rather than a plain success flag.
Parameters
source
count
number
message
string
Returns
number
resolvePosition()
resolvePosition(
triple,source):Vector3
Defined in: commands/src/commands/support.ts:60
Turns a parsed coordinate triple into an absolute position.
~ is relative to the source's position and ^ is local to its facing, measured left, up and forward in that order, which is Java's order.
Parameters
triple
source
Returns
Throws
When ^ and the other two forms are mixed, which Java also refuses.
resolveRotation()
resolveRotation(
yaw,pitch,source):Rotation
Defined in: commands/src/commands/support.ts:86
Turns a yaw and a pitch, either of which may be relative, into a rotation.
Parameters
yaw
pitch
source
Returns
resourceArgument()
resourceArgument(
registry,values?):BedrockDescribedType<string>
Defined in: commands/src/argumentTypes.ts:502
A registry id, minecraft:resource and its tag-accepting variants.
Geyser's rule is the one to copy: the registries Bedrock publishes an enum for become enums of their contents and everything else degrades to a string.
Mojang's published list is frozen at the version the table was generated from, so it is the wrong thing to validate against on its own once content packs are loaded: /summon mypack:dragon would be refused at parse for an entity the server can spawn. Pass values and the two are accepted together. Added rather than substituted, because a server whose build omits a vanilla id should not make that id unspellable, and because Mojang's list is what a Bedrock client completes from.
Bedrock command enum values must be lowercase. Values are lowercased when advertised, then resolved back to the registry's identifier when parsed.
Parameters
registry
string
The registry id, used in the report and in the enum name when Bedrock publishes no enum for it.
values?
readonly string[]
The ids the server's own registry holds, namespaced.
Returns
BedrockDescribedType<string>
scoreHolderArgument()
scoreHolderArgument(
options?):BedrockDescribedType<ScoreHolderModel>
Defined in: commands/src/argumentTypes.ts:174
One score holder.
Parameters
options?
dialect picks the grammar a selector is read in.
dialect?
Returns
BedrockDescribedType<ScoreHolderModel>
scoreHolderOne()
scoreHolderOne(
source,holder):string
Defined in: commands/src/commands/support.ts:127
Resolves a score holder that must name exactly one.
Parameters
source
holder
Returns
string
Throws
When it named none or several, which is what Java's single-holder form does.
scoreHolders()
scoreHolders(
source,holder): readonlystring[]
Defined in: commands/src/commands/support.ts:115
Resolves a score holder to the names the scoreboard keys on.
A selector resolves to the names of the entities it matched, a bare name is itself, and * is every holder the scoreboard already tracks - which is what makes /scoreboard players reset * the command that clears the board.
Parameters
source
holder
Returns
readonly string[]
select()
select(
source,selector): readonlyEntityRef[]
Defined in: commands/src/commands/support.ts:92
Resolves a selector against the world through the host.
Parameters
source
selector
Returns
readonly EntityRef[]
selectOne()
selectOne(
source,selector):EntityRef
Defined in: commands/src/commands/support.ts:101
Resolves a selector that must match exactly one entity.
Parameters
source
selector
Returns
Throws
When the selector matched none or several, which is what Java's entity(single) argument does.
softEnumArgument()
softEnumArgument(
name):BedrockDescribedType<string>
Defined in: commands/src/argumentTypes.ts:395
A value list the server fills at runtime over UpdateSoftEnumPacket.
Vanilla Bedrock has exactly four: ScoreboardObjectives, TagValues, GameTestName and GameTestTag.
Parameters
name
string
Returns
BedrockDescribedType<string>
softEnumParseSymbol()
softEnumParseSymbol(
index):number
Defined in: commands/src/parameterTypes.ts:132
Builds the Parse Symbol word of a soft enum parameter.
Parameters
index
number
The enum's position in the packet's Soft Enums list, which is numbered separately from the hard enum list.
Returns
number
source()
source(
context):CommandSource
Defined in: commands/src/commands/support.ts:153
Reads the source out of a Brigadier context.
Parameters
context
Returns
storeCommandResults()
storeCommandResults(
dispatcher):void
Defined in: commands/src/commands/execute.ts:733
Feeds every command result back to the execute store sinks waiting on its source.
The Brigadier port predates upstream's ContextChain, so there is no staged execution to hang a CommandResultCallback off. The dispatcher's ResultConsumer sees the same thing, one call per executed context, so store is wired through it. Call this once per dispatcher.
Parameters
dispatcher
CommandDispatcher<CommandSource>
Returns
void
Throws
Nothing. A result the port passes as an exception rather than a number, which it does on a failed branch, is recorded as a failure with value 0.
stringArgument()
stringArgument():
BedrockDescribedType<string>
Defined in: commands/src/argumentTypes.ts:272
A single word, the ID type. This is the fallback everything else degrades to.
Returns
BedrockDescribedType<string>
suggestFromData()
suggestFromData<
S>(values):SuggestionProvider<S>
Defined in: commands/src/suggestions.ts:15
Builds a suggestion provider from a fixed list or values selected from the parsed command.
Suggestions match the current input prefix without regard to case, and duplicate values are returned once.
Type Parameters
S
S
Parameters
values
readonly string[] | ((context) => Iterable<string>)
Candidate values, or a function that selects them from the parsed context.
Returns
SuggestionProvider<S>
A Brigadier provider that suggests matching candidate values.
testCommandHost()
testCommandHost(
overrides?):CommandHost
Defined in: commands/src/testing.ts:157
Builds a CommandHost whose every verb reports that nothing happened.
Parameters
overrides?
Replacements, merged per group, so a test can name one method without restating the other fifty.
Returns
testEntity()
testEntity(
overrides?):EntityRef
Defined in: commands/src/testing.ts:166
Builds an entity reference with sensible defaults, for tests.
Parameters
overrides?
Partial<EntityRef> = {}
Returns
timeArgument()
timeArgument(
bounds?):BedrockDescribedType<number>
Defined in: commands/src/argumentTypes.ts:249
A duration in ticks, Java's minecraft:time.
A bare number is ticks, and the suffixes in TIME_UNIT_TICKS scale it, so 5s is 100 and 2d is 48000. The amount may be fractional, as Java's TimeArgument allows, and the product is rounded to a whole tick.
Bedrock has no type for "a number with an optional unit": its four POSTFIX_* types each require their own suffix, and the bare form is the one Bedrock operators type. So the client is told INT and the suffixes are read here.
Parameters
bounds?
Compared against the tick count, after the unit scales it.
max?
number
min?
number
Returns
BedrockDescribedType<number>
toDimensionId()
toDimensionId(
name):string
Defined in: commands/src/commands/support.ts:215
The Java dimension id a dimension argument names.
A namespaced id, minecraft:the_nether or mypack:skylands, is taken as it is. A bare name is given the minecraft: namespace, and Bedrock's nether becomes Java's the_nether.
Parameters
name
string
Returns
string
value()
value<
T>(context,name):T
Defined in: commands/src/commands/support.ts:150
Reads a parsed argument.
The port's CommandContext.getArgument is untyped, so the type a command expects is named at the call site instead.
Type Parameters
T
T
Parameters
context
name
string
Returns
T
wildcardIntegerArgument()
wildcardIntegerArgument():
BedrockDescribedType<number|"*">
Defined in: commands/src/argumentTypes.ts:262
An integer or *, the WILDCARDINT type.
Returns
BedrockDescribedType<number | "*">