Minecraft:Argument types: Difference between revisions
More actions
Sync: updated from Minecraft |
Sync: updated from Minecraft |
||
| (One intermediate revision by the same user not shown) | |||
| Line 173: | Line 173: | ||
* [[Minecraft:Block state]]s are inside <code>[]</code>, comma-separated and properties and values must be supported by the block or all blocks in the tag. They are optional. | * [[Minecraft:Block state]]s are inside <code>[]</code>, comma-separated and properties and values must be supported by the block or all blocks in the tag. They are optional. | ||
** <code>minecraft:stone[doesntexist=purpleberry]</code> is unparseable, because <code>stone</code> doesn't have <code>doesntexist</code>. | ** <code>minecraft:stone[doesntexist=purpleberry]</code> is unparseable, because <code>stone</code> doesn't have <code>doesntexist</code>. | ||
** <code>minecraft:redstone_wire[power=tuesday]</code> is unparseable, because <code>redstone_wire</code>'s <code>power</code> is a number between 0 and 15. | ** <code>minecraft:redstone_wire[power=tuesday]</code> is unparseable, because <code>redstone_wire</code>'s <code>power</code> is a number between <code>0</code> and <code>15</code>. | ||
* [[Minecraft:NBT format|Data tags]] are inside <code>{}</code>. They are optional. | * [[Minecraft:NBT format|Data tags]] are inside <code>{}</code>. They are optional. | ||
* When test for block, only the states provided are tested. | * When test for block, only the states provided are tested. | ||
** If a command tests for <code>redstone_wire[power=15]</code>, it checks only power, but ignores other states such as <code>north</code>. | ** If a command tests for <code>redstone_wire[power=15]</code>, it checks only <code>power</code>, but ignores other states such as <code>north</code>. | ||
<div class="collapsible collapsed collapsetoggle-inline" data-expandtext="show" data-collapsetext="hide"> | <div class="collapsible collapsed collapsetoggle-inline" data-expandtext="show" data-collapsetext="hide"> | ||
| Line 195: | Line 195: | ||
* [[Minecraft:Block state]]s are inside <code>[]</code>, comma-separated and must be properties/values supported by the blocks. They are optional. | * [[Minecraft:Block state]]s are inside <code>[]</code>, comma-separated and must be properties/values supported by the blocks. They are optional. | ||
** <code>minecraft:stone[doesntexist=purpleberry]</code> is unparseable, because <code>stone</code> doesn't have <code>doesntexist</code>. | ** <code>minecraft:stone[doesntexist=purpleberry]</code> is unparseable, because <code>stone</code> doesn't have <code>doesntexist</code>. | ||
** <code>minecraft:redstone_wire[power=tuesday]</code> is unparseable, because <code>redstone_wire</code>'s <code>power</code> is a number between 0 and 15. | ** <code>minecraft:redstone_wire[power=tuesday]</code> is unparseable, because <code>redstone_wire</code>'s <code>power</code> is a number between <code>0</code> and <code>15</code>. | ||
* [[Minecraft:NBT format|Data tags]] are inside <code>{}</code>. They are optional. | * [[Minecraft:NBT format|Data tags]] are inside <code>{}</code>. They are optional. | ||
* When placing blocks, any states provided are set, but anything omitted retain their default values, depending on the block type. | * When placing blocks, any states provided are set, but anything omitted retain their default values, depending on the block type. | ||
** If a command sets <code>redstone_wire[power=15]</code>, it is set <code>power</code> to 15, but <code>north</code> is a default value (in this case, set to <code>none</code>). | ** If a command sets <code>redstone_wire[power=15]</code>, it is set <code>power</code> to <code>15</code>, but <code>north</code> is a default value (in this case, set to <code>none</code>). | ||
<div class="collapsible collapsed collapsetoggle-inline" data-expandtext="show" data-collapsetext="hide"> | <div class="collapsible collapsed collapsetoggle-inline" data-expandtext="show" data-collapsetext="hide"> | ||
| Line 360: | Line 360: | ||
</div></div> | </div></div> | ||
{{anchor|hex_color}} | {{anchor|hex_color}} | ||
=== minecraft:hex_color=== | === minecraft:hex_color=== | ||
{{Arg desc|je=hex_color}} | {{Arg desc|je=hex_color}} | ||
It is allow to place a plus or minus sign ({{cd|+}} or {{cd|-}}) for each color; however, the sign will count as a digit. For example, {{cd|+F+F+F}} is the same as {{cd|0F0F0F}}, and {{cd|-F+FF}} is the same as {{cd|F10FFF}}. {{Tooltip|{{cd|+FF}}|'+' is not a valid number}} or {{Tooltip|{{cd|+FFF}}|it has 4 digits}} are not allowed. | |||
<div class="collapsible collapsed collapsetoggle-inline" data-expandtext="show" data-collapsetext="hide"> | <div class="collapsible collapsed collapsetoggle-inline" data-expandtext="show" data-collapsetext="hide"> | ||
| Line 371: | Line 372: | ||
* {{cd|FF0000}} | * {{cd|FF0000}} | ||
</div></div> | </div></div> | ||
{{anchor|int_range}} | {{anchor|int_range}} | ||
| Line 705: | Line 705: | ||
{{anchor|resource_selector}} | {{anchor|resource_selector}} | ||
=== minecraft:resource_selector === | === minecraft:resource_selector === | ||
{{arg desc|je=resource_selector}} | |||
<div class="collapsible collapsed collapsetoggle-inline" data-expandtext="show" data-collapsetext="hide"> | <div class="collapsible collapsed collapsetoggle-inline" data-expandtext="show" data-collapsetext="hide"> | ||
| Line 766: | Line 764: | ||
* {{cd|foo.bar}} | * {{cd|foo.bar}} | ||
</div></div> | </div></div> | ||
{{Anchor|slot_source}} | |||
=== minecraft:slot_source === | === minecraft:slot_source === | ||
{{in development|java||26.3|section=1}} | {{in development|java||26.3|section=1}} | ||
| Line 1,062: | Line 1,059: | ||
|{{HistoryLine||1.20.5|dev=24w10a|Added <code>minecraft:item_slots</code> argument type.}} | |{{HistoryLine||1.20.5|dev=24w10a|Added <code>minecraft:item_slots</code> argument type.}} | ||
|{{HistoryLine||26.2|dev=snap5|Removed <code>minecraft:color</code> argument type. Replaced by <code>minecraft:team_color</code>}} | |{{HistoryLine||26.2|dev=snap5|Removed <code>minecraft:color</code> argument type. Replaced by <code>minecraft:team_color</code>}} | ||
|{{HistoryLine|upcoming java}} | |||
|{{HistoryLine||26.3|dev=snap1|Added {{cd|minecraft:slot_source}} argument type, replacing all uses of {{cd|minecraft:item_slots}} argument type, although the {{cd|minecraft:item_slots}} still exists.}} | |||
|{{HistoryLine|||dev=snap3|Added {{cd|minecraft:feature}} argument type.}} | |||
|{{HistoryLine|||dev=snap7|Added {{cd|minecraft:swing_animation}} argument type.}} | |||
}} | }} | ||
Latest revision as of 11:04, 2 September 2026
This page contains a list of all command argument types. Template:TOC
Java Edition
brigadier:bool
Official examples
brigadier:double
Each double argument may have a custom minimum and maximum value.
Precision varies throughout number line; the maximum absolute value is about 1.8×10308.
Official examples
JSON properties in command syntax output
- Template:Nbt: The root properties object.
- Template:Nbt: The maximum value of this double argument.
- Template:Nbt: The minimum value of this double argument.
brigadier:float
Each float argument type may have a custom minimum and maximum value.
Precision varies throughout number line; the maximum absolute value is about 3.4×1038.
Official examples
JSON properties in command syntax output
- Template:Nbt: The root properties object.
- Template:Nbt: The maximum value of this float argument.
- Template:Nbt: The minimum value of this float argument.
brigadier:integer
Each integer argument type may have a custom minimum and maximum value.
Maximum range is from −(231) to (231 − 1), or from (−2,147,483,648) to (2,147,483,647).
Official examples
JSON properties in command syntax output
- Template:Nbt: The root properties object.
- Template:Nbt: The maximum value of this integer argument.
- Template:Nbt: The minimum value of this integer argument.
brigadier:long
Note: Although a long argument type is present in Minecraft:brigadier, it is not used by Minecraft.
Each long argument type may have a custom minimum and maximum value.
Maximum range is from −(263) to (263−1), or from (−9,223,372,036,854,775,808) to (9,223,372,036,854,775,807).
Official examples
JSON properties in command syntax output
- Template:Nbt: The root properties object.
- Template:Nbt: The maximum value of this long argument.
- Template:Nbt: The minimum value of this long argument.
brigadier:string
Each string argument type can accept either a single word (no spaces), a quotable phrase (either single word or quoted string), or a greedy phrase (taking the rest of the command as the string argument).
Official examples
Single word
Quotable phrase
Greedy phrase
JSON properties in command syntax output
- Template:Nbt: The root properties object.
- Template:Nbt: The type of this string argument. Can be Template:Cd, Template:Cd, or Template:Cd
minecraft:angle
Official examples
minecraft:block_pos
Official examples
minecraft:block_predicate
The format of block_predicate parameters is block_id[block_states]{data_tags}, in which block states and data tags can be omitted when they are not needed.
block_idis required, and it should be in the format of Minecraft:resource location(if namespace isn't set it defaults tominecraft:).- It can also be the resource location of a block tag prefixed with
#, such as#minecraft:planks.
- It can also be the resource location of a block tag prefixed with
- Minecraft:Block states are inside
[], comma-separated and properties and values must be supported by the block or all blocks in the tag. They are optional.minecraft:stone[doesntexist=purpleberry]is unparseable, becausestonedoesn't havedoesntexist.minecraft:redstone_wire[power=tuesday]is unparseable, becauseredstone_wire'spoweris a number between0and15.
- Data tags are inside
{}. They are optional. - When test for block, only the states provided are tested.
- If a command tests for
redstone_wire[power=15], it checks onlypower, but ignores other states such asnorth.
- If a command tests for
Official examples
- Template:Cd
- Template:Cd
stone[foo=bar]- Template:Cd
#stone[foo=bar]{baz:nbt}
minecraft:block_state
The format of block_state parameters is block_id[block_states]{data_tags}, in which block states and data tags can be omitted when they are not needed.
block_idis required, and it should be in the format of Minecraft:resource location (if namespace isn't set it defaults tominecraft:).- Minecraft:Block states are inside
[], comma-separated and must be properties/values supported by the blocks. They are optional.minecraft:stone[doesntexist=purpleberry]is unparseable, becausestonedoesn't havedoesntexist.minecraft:redstone_wire[power=tuesday]is unparseable, becauseredstone_wire'spoweris a number between0and15.
- Data tags are inside
{}. They are optional. - When placing blocks, any states provided are set, but anything omitted retain their default values, depending on the block type.
- If a command sets
redstone_wire[power=15], it is setpowerto15, butnorthis a default value (in this case, set tonone).
- If a command sets
Official examples
- Template:Cd
- Template:Cd
stone[foo=bar]foo{bar:baz}
minecraft:column_pos
Official examples
minecraft:component
Official examples
minecraft:dialog
Official examples
minecraft:dimension
Official examples
minecraft:entity
Each entity argument may place limits on the number of entities (single/multiple) selected or the type of entities (player/any entity) selected.
Official examples
- Template:Cd
- Template:Cd
- Template:Cd
@e[type=foo]- Template:Cd
JSON properties in command syntax output
- Template:Nbt: The root properties object.
- Template:Nbt: The amount of entities that can be selected. Can be Template:Cd or Template:Cd.
- Template:Nbt: The target entity type. Can be Template:Cd or Template:Cd.
minecraft:entity_anchor
Official examples
minecraft:feature
Template:In development Template:Arg desc
Official examples
minecraft:float_range
Official examples
minecraft:function
Official examples
minecraft:game_profile
Official examples
minecraft:gamemode
Official examples
minecraft:heightmap
Official examples
minecraft:hex_color
It is allow to place a plus or minus sign (Template:Cd or Template:Cd) for each color; however, the sign will count as a digit. For example, Template:Cd is the same as Template:Cd, and Template:Cd is the same as Template:Cd. Template:Tooltip or Template:Tooltip are not allowed.
Official examples
minecraft:int_range
Official examples
minecraft:item_predicate
The format of item_predicate parameters is <item_type>[<list of tests>], in which the list of tests with [] can be omitted when not needed.
<item_type>is required.- It can be in the format of Minecraft:resource location (if namespace isn't set it defaults to
minecraft:). - It can also be the resource location of a block tag or item tag with the prefix of
#, such as#minecraft:planks. - It can also be a wildcard character
*to match any item type.
- It can be in the format of Minecraft:resource location (if namespace isn't set it defaults to
- The list of tests is optional. Test entries are inside
[]and separated with<separator>. - A test entry can be:
<component_id>- Checks if a component exists.<component_id>is the ID of a Minecraft:data component.
<component_id>=<value>- Matches exact value of a component.<value>is a representation of component value in SNBT format.
<predicate_id>~<value>- Checks an item sub-predicate<predicate_id>is the ID of an Minecraft:item sub-predicate.<value>is a representation of item sub-predicate in SNBT format.- Example:
*[damage~{durability:{min:3}}]matches any stack with at least 3 uses left.
minecraft:count- Matches the stack size.count- Always passes.count=<positive_int>- Passes only when the stack size equals to the given value.count~<positive_int>- Passes only when the stack size equals to the given value.count~<int_range>- Passes when the stack size is in the specified range.<int_range>is an SNBT of{min:<min value>, max:<max value>}. Both min and max are optional.
- Example:
*[count~{max:2}]matches any stack with count <= 2.
- Any test entry above can be negated by prefixing with
!.- Example:
*[!count=1]matches any stack that has count other than 1.
- Example:
- A
<separator>can be:|- Logical OR.,- Logical AND.- Unlike most programming languages, the precedence of
|(Logical OR) is higher than,(Logical AND). - That means tests entries joined with | are treated as a single entry to check multiple alternatives.
- Example:
*[!damage|damage=0, count=1]looks for items without damage component or with 0 damage, and its count must be 1.
Official examples
minecraft:item_slot
Official examples
minecraft:item_slots
Official examples
minecraft:item_stack
The format of item_stack is <item_id>[<list of components>], in which the list of components with [] can be omitted when not needed.
<item_id>is required, and it should be in the format of Minecraft:resource location (if namespace isn't set it defaults tominecraft:).- The list of data components is optional. Data component entries are inside
[]separated with,.- A data component entry can be:
<component_id>=<value>- Sets value of a data component.<component_id>is the ID of a Minecraft:data component.<value>is a representation of component value in SNBT format.
!<component_id>- Removes a default data component of the item.
- A data component entry can be:
- When giving items, any components provided are set or removed, but anything omitted retain their default values, depending on the item type.
Official examples
- Template:Cd
- Template:Cd
stick{foo=bar}<ref>The official code examples include an incorrect example where it is using a mix of the new syntax and the old syntax.</ref>
minecraft:loot_modifier
Official examples
minecraft:loot_predicate
Official examples
minecraft:loot_table
Official examples
minecraft:message
Official examples
minecraft:nbt_compound_tag
Official examples
{}{foo:bar}
minecraft:nbt_path
An example
- Template:Cd
- Template:Cd
- <the first list element>
- <the second list element>
- Template:Cd
Official examples
- Template:Cd
- Template:Cd
- Template:Cd
- Template:Cd
[]{foo:bar}
minecraft:nbt_tag
Official examples
- Template:Cd
- Template:Cd
- Template:Cd
- Template:Cd
- Template:Cd
{foo:bar}
minecraft:objective
Official examples
minecraft:objective_criteria
Official examples
minecraft:operation
Official examples
minecraft:particle
Official examples
minecraft:resource
Official examples
JSON properties in command syntax output
- Template:Nbt: The root properties object.
- Template:Nbt: The registry ID.
minecraft:resource_key
Official examples
JSON properties in command syntax output
- Template:Nbt: The root properties object.
- Template:Nbt: The registry ID.
minecraft:resource_location
Template:Arg desc It is resolved during command execution into the unregistered content, or sent to the client to resolve into a client-side content.
Official examples
minecraft:resource_or_tag
Official examples
JSON properties in command syntax output
- Template:Nbt: The root properties object.
- Template:Nbt: The registry ID.
minecraft:resource_or_tag_key
Official examples
JSON properties in command syntax output
- Template:Nbt: The root properties object.
- Template:Nbt: The registry ID.
minecraft:resource_selector
Official examples
- Template:Cd - matches all IDs
- Template:Cd - matches everything in the
minecraftnamespace - Template:Cd - matches IDs in the
foldersubfolder in thecustomnamespace that end in_test_followed by one additional character.
minecraft:rotation
Official examples
minecraft:score_holder
Each score holder argument may specify if it can select only one score holder or multiple score holders.
Examples
Official examples
JSON properties in command syntax output
- Template:Nbt: The root properties object.
- Template:Nbt: The amount of score holders that can be selected. Can be Template:Cd or Template:Cd.
minecraft:scoreboard_slot
Official examples
minecraft:slot_source
Template:In development Template:Arg desc
Official examples
minecraft:style
Official examples
minecraft:swing_animation
Template:In development Template:Arg desc
Official examples
minecraft:swizzle
Official examples
minecraft:team
Official examples
minecraft:team_color
Official examples
minecraft:template_mirror
Official examples
minecraft:template_rotation
Official examples
minecraft:time
Official examples
JSON properties in command syntax output
- Template:Nbt: The root properties object.
- Template:Nbt: The minimum time in game ticks.
minecraft:uuid
Official examples
minecraft:vec2
Official examples
minecraft:vec3
Official examples
Removed
minecraft:entity_summon
Official examples
minecraft:item_enchantment
Official examples
minecraft:mob_effect
Official examples
Bedrock Edition
BlockStateCommandParam
Also known as BLOCK_STATE_ARRAY.
CommandCompareOperator
Also known as COMPAREOPERATOR.
CommandFilePath
Also known as PATHCOMMAND.
CommandIntegerRange
Also known as FULLINTEGERRANGE.
CommandMessage
Also known as MESSAGE_ROOT.
CommandOperator
Also known as OPERATOR.
CommandPosition
Also known as POSITION.
CommandPositionFloat
Also known as POSITION_FLOAT.
CommandRawText
Also known as RAWTEXT.
Template:Arg desc Template:AnchorTemplate:Anchor
CommandSelector<Actor> and CommandSelector<Player>
Also known as SELECTION.
CommandSelector<Actor> is used to specify entities. Template:Arg desc
CommandSelector<Player> is used to specify players. Template:Arg desc
CommandWildcardInt
Also known as WILDCARDINT.
Must be a 32-bit integer, or an asterisk (Template:Cd) to represent MIN_INT(-2,147,483,648),
float
Also known as VAL.
int
Also known as INT.
Json::Value
Also known as JSON_OBJECT.
RelativeFloat
Also known as RVAL.
Template:Arg desc Template:Anchor
std::basic_string
Also known as ID.
Template:Arg desc Template:Anchor
std::unique_ptr<Command>
Also known as SLASHCOMMAND.
Represents a complete command.
WildcardCommandSelector<Actor>
Also known as WILDCARDSELECTION.
Template:Arg desc Template:Anchor
Enum
Must be an unquoted string without space.
History
References
<references/>
Minecraft:fr:Types d'arguments Minecraft:ja:引数の型 Minecraft:lzh:附項之類 Minecraft:pt:Tipos de argumentos Minecraft:ru:Типы аргументов Minecraft:zh:参数类型