Command Data: Difference between revisions
imported>BruceChen (Update Parsers data for 1.19.3) |
imported>Outblasted (Update for 1.19.4: add properties for "time" parser and add "heightmap" parser) |
||
| Line 1: | Line 1: | ||
=== Parsers === | === Parsers === | ||
| Line 312: | Line 238: | ||
| 40 | | 40 | ||
| <code>minecraft:time</code> | | <code>minecraft:time</code> | ||
| | | [[ #minecraft:time | See below ]] | ||
| Represents a time duration. | | Represents a time duration. | ||
|- | |- | ||
| Line 346: | Line 272: | ||
|- | |- | ||
| 47 | | 47 | ||
| <code>minecraft:heightmap</code> | |||
| | |||
| TODO | |||
|- | |||
| 48 | |||
| <code>minecraft:uuid</code> | | <code>minecraft:uuid</code> | ||
| | | | ||
| Line 513: | Line 444: | ||
| Boolean | | Boolean | ||
| Whether decimal values are allowed. | | Whether decimal values are allowed. | ||
|} | |||
===== <code>minecraft:time</code> ===== | |||
{| class="wikitable" | |||
! Name | |||
! Type | |||
! Description | |||
|- | |||
| Min | |||
| Integer | |||
| Minimum duration in ticks | |||
|} | |} | ||
| Line 596: | Line 539: | ||
* Registered in https://github.com/MinecraftForge/MinecraftForge/blob/19f8d2a7937dc7968ecbef2f9785687193fcd210/src/main/java/net/minecraftforge/common/ForgeMod.java#L175 | * Registered in https://github.com/MinecraftForge/MinecraftForge/blob/19f8d2a7937dc7968ecbef2f9785687193fcd210/src/main/java/net/minecraftforge/common/ForgeMod.java#L175 | ||
* Serialized in https://github.com/MinecraftForge/MinecraftForge/blob/bca20ace4ecb1da07806c8fc6c749826c3bd57e1/src/main/java/net/minecraftforge/server/command/EnumArgument.java | * Serialized in https://github.com/MinecraftForge/MinecraftForge/blob/bca20ace4ecb1da07806c8fc6c749826c3bd57e1/src/main/java/net/minecraftforge/server/command/EnumArgument.java | ||
Revision as of 05:55, 14 April 2023
Parsers
Clients are expected to implement all parsers, including properties (if any). If an unknown parser is encountered by a client, unpacking of the Declare Commands packet should stop immediately, as the structure of the remainder of the packet cannot be guessed.
In 1.19, Parsers are identified by a varint id. Pre-1.19, parsers are identified by a string id.
| Varint ID | String Identifier | Properties | Description |
|---|---|---|---|
| 0 | brigadier:bool
|
Boolean value (true or false, case-sensitive)
| |
| 1 | brigadier:float
|
See below | Float |
| 2 | brigadier:double
|
See below | Double |
| 3 | brigadier:integer
|
See below | Integer |
| 4 | brigadier:long
|
See below | Long |
| 5 | brigadier:string
|
See below | A string |
| 6 | minecraft:entity
|
See below | A selector, player name, or UUID. |
| 7 | minecraft:game_profile
|
A player, online or not. Can also use a selector, which may match one or more players (but not entities). | |
| 8 | minecraft:block_pos
|
A location, represented as 3 numbers (which must be integers). May use relative locations with ~.
| |
| 9 | minecraft:column_pos
|
A column location, represented as 3 numbers (which must be integers). May use relative locations with ~.
| |
| 10 | minecraft:vec3
|
A location, represented as 3 numbers (which may have a decimal point, but will be moved to the center of a block if none is specified). May use relative locations with ~.
| |
| 11 | minecraft:vec2
|
A location, represented as 2 numbers (which may have a decimal point, but will be moved to the center of a block if none is specified). May use relative locations with ~.
| |
| 12 | minecraft:block_state
|
A block state, optionally including NBT and state information. | |
| 13 | minecraft:block_predicate
|
A block, or a block tag. | |
| 14 | minecraft:item_stack
|
An item, optionally including NBT. | |
| 15 | minecraft:item_predicate
|
An item, or an item tag. | |
| 16 | minecraft:color
|
A chat color. One of the names from Chat#Colors, or reset. Case-insensitive.
| |
| 17 | minecraft:component
|
A JSON Chat component. | |
| 18 | minecraft:message
|
A regular message, potentially including selectors. | |
| 19 | minecraft:nbt
|
An NBT value, parsed using JSON-NBT rules. | |
| 20 | minecraft:nbt_tag
|
Represents a partial nbt tag, usable in data modify command. | |
| 21 | minecraft:nbt_path
|
A path within an NBT value, allowing for array and member accesses. | |
| 22 | minecraft:objective
|
A scoreboard objective. | |
| 23 | minecraft:objective_criteria
|
A single score criterion. | |
| 24 | minecraft:operation
|
A scoreboard operator. | |
| 25 | minecraft:particle
|
A particle effect (an identifier with extra information following it for specific particles, mirroring the Particle packet) | |
| 26 | minecraft:angle
|
||
| 27 | minecraft:rotation
|
An angle, represented as 2 numbers (which may have a decimal point, but will be moved to the center of a block if none is specified). May use relative locations with ~.
| |
| 28 | minecraft:scoreboard_slot
|
A scoreboard display position slot. list, sidebar, belowName, and sidebar.team.${color} for all chat colors (reset is not included)
| |
| 29 | minecraft:score_holder
|
See below | Something that can join a team. Allows selectors and *.
|
| 30 | minecraft:swizzle
|
A collection of up to 3 axes. | |
| 31 | minecraft:team
|
The name of a team. Parsed as an unquoted string. | |
| 32 | minecraft:item_slot
|
A name for an inventory slot. | |
| 33 | minecraft:resource_location
|
An Identifier. | |
| (Not in 1.19.3) | minecraft:mob_effect
|
A potion effect. | |
| 34 | minecraft:function
|
A function. | |
| 35 | minecraft:entity_anchor
|
The entity anchor related to the facing argument in the teleport command, is feet or eyes. | |
| (Not in 1.19) | minecraft:range
|
See below | A range of values with a min and a max. |
| 36 | minecraft:int_range
|
An integer range of values with a min and a max. | |
| 37 | minecraft:float_range
|
A floating-point range of values with a min and a max. | |
| (Not in 1.19.3) | minecraft:item_enchantment
|
Represents a item enchantment. | |
| (Not in 1.19.3) | minecraft:entity_summon
|
Represents an entity summon. | |
| 38 | minecraft:dimension
|
Represents a dimension. | |
| 39 | minecraft:gamemode
|
Represents a gamemode. (survival, creative, adventure or spectator)
| |
| (Not in 1.19) | minecraft:nbt_compound_tag
|
Represents a full nbt tag. | |
| 40 | minecraft:time
|
See below | Represents a time duration. |
| 41 | minecraft:resource_or_tag
|
See below | An identifier or a tag name for a registry. |
| 42 | minecraft:resource_or_tag_key
|
See below | An identifier or a tag name for a registry. |
| 43 | minecraft:resource
|
See below | An identifier for a registry. |
| 44 | minecraft:resource_key
|
See below | An identifier for a registry. |
| 45 | minecraft:template_mirror
|
Template mirror | |
| 46 | minecraft:template_rotation
|
Template rotation | |
| 47 | minecraft:heightmap
|
TODO | |
| 48 | minecraft:uuid
|
Represents a UUID value. | |
| ? | forge:modid
|
Represents a mod identifier. Added by Minecraft Forge. Vanilla clients/servers do not support this parser. | |
| ? | forge:enum
|
Represents a enum class to use for suggestion. Added by Minecraft Forge. Vanilla clients/servers do not support this parser. |
Properties
brigadier:double
Specifies min and max values.
| Name | Type | Description |
|---|---|---|
| Flags | Byte | |
| Min | Optional double | Only if flags & 0x01. If not specified, defaults to -Double.MAX_VALUE (≈ -1.7976931348623157E307)
|
| Max | Optional double | Only if flags & 0x02. If not specified, defaults to Double.MAX_VALUE (≈ 1.7976931348623157E307)
|
brigadier:float
Specifies min and max values.
| Name | Type | Description |
|---|---|---|
| Flags | Byte | |
| Min | Optional float | Only if flags & 0x01. If not specified, defaults to -Float.MAX_VALUE (≈ 3.4028235E38)
|
| Max | Optional float | Only if flags & 0x02. If not specified, defaults to Float.MAX_VALUE (≈ 3.4028235E38)
|
brigadier:integer
Specifies min and max values.
| Name | Type | Description |
|---|---|---|
| Flags | Byte | |
| Min | Optional integer | Only if flags & 0x01. If not specified, defaults to Integer.MIN_VALUE (-2147483648)
|
| Max | Optional integer | Only if flags & 0x02. If not specified, defaults to Integer.MAX_VALUE (2147483647)
|
brigadier:long
Specifies min and max values.
| Name | Type | Description |
|---|---|---|
| Flags | Byte | |
| Min | Optional long | Only if flags & 0x01. If not specified, defaults to Long.MIN_VALUE (−9,223,372,036,854,775,808)
|
| Max | Optional long | Only if flags & 0x02. If not specified, defaults to Long.MAX_VALUE (9,223,372,036,854,775,807)
|
brigadier:string
A VarInt enum.
| Value | Name | Description |
|---|---|---|
| 0 | SINGLE_WORD
|
Reads a single word |
| 1 | QUOTABLE_PHRASE
|
If it starts with a ", keeps reading until another " (allowing escaping with \). Otherwise behaves the same as SINGLE_WORD
|
| 2 | GREEDY_PHRASE
|
Reads the rest of the content after the cursor. Quotes will not be removed. |
minecraft:entity
Has a single flags byte.
| Bit mask | Meaning |
|---|---|
| 0x01 | If set, only allows a single entity/player |
| 0x02 | If set, only allows players |
minecraft:score_holder
Has a single flags byte:
| Bit mask | Meaning |
|---|---|
| 0x01 | If set, allows multiple. |
minecraft:range
A range of values with a min and a max.
| Name | Type | Description |
|---|---|---|
| Decimals | Boolean | Whether decimal values are allowed. |
minecraft:time
| Name | Type | Description |
|---|---|---|
| Min | Integer | Minimum duration in ticks |
minecraft:resource_or_tag
Has a single identifier.
| Name | Type | Description |
|---|---|---|
| Registry | Identifier | The registry from where suggestions will be sourced from. |
minecraft:resource_or_tag_key
Has a single identifier.
| Name | Type | Description |
|---|---|---|
| Registry | Identifier | The registry from where suggestions will be sourced from. |
minecraft:resource
Has a single identifier.
| Name | Type | Description |
|---|---|---|
| Registry | Identifier | The registry from where suggestions will be sourced from. |
minecraft:resource_key
Has a single identifier.
| Name | Type | Description |
|---|---|---|
| Registry | Identifier | The registry from where suggestions will be sourced from. |
forge:modid
Added by Minecraft Forge, vanilla clients/servers do not have this.
- Registered in https://github.com/MinecraftForge/MinecraftForge/blob/19f8d2a7937dc7968ecbef2f9785687193fcd210/src/main/java/net/minecraftforge/common/ForgeMod.java#L175
- Serialized in https://github.com/MinecraftForge/MinecraftForge/blob/9177ac1b2e326a3acffaf476eeff28a1cf9a637f/src/main/java/net/minecraftforge/server/command/ModIdArgument.java
forge:enum
Added by Minecraft Forge, vanilla clients/servers do not have this. Enum class to use for suggestions. The value is literally as is fed into the java method Class.forName see net.minecraftforge.server.command.EnumArgument
| Name | Type | Description |
|---|---|---|
| Class | String | Enum Class to use |
- Registered in https://github.com/MinecraftForge/MinecraftForge/blob/19f8d2a7937dc7968ecbef2f9785687193fcd210/src/main/java/net/minecraftforge/common/ForgeMod.java#L175
- Serialized in https://github.com/MinecraftForge/MinecraftForge/blob/bca20ace4ecb1da07806c8fc6c749826c3bd57e1/src/main/java/net/minecraftforge/server/command/EnumArgument.java