Difference between revisions of "Slot Data"

From wiki.vg
Jump to navigation Jump to search
m (Add categories "Protocol Details" and "Minecraft Modern")
m (fixed typo)
 
(34 intermediate revisions by 20 users not shown)
Line 1: Line 1:
The '''slot''' data structure is how Minecraft represents an item and its associated data in the [[Protocol|minecraft protocol]]
+
The '''Slot''' data structure defines how an item is represented when inside an inventory window of any kind, such as a chest or furnace.
  
== Format ==
+
This page presents the new Slot data structure, using structured components. You can find the documentation of the old structure, that utilizes raw NBT data, [[Special:Permalink/18899|here]].
  
The structure consists of at least a short, which gives the item/block ID [http://www.minecraftwiki.net/wiki/Block_ids]. A value of <code>-1</code> signifies that the slot is empty, and no further data follows.
+
= Format =
  
If the block ID is not <code>-1</code>, three more fields follow. These fields are a byte (item count), a short (item damage), and another short (length of optional NBT data).
+
{| class="wikitable"
 +
! colspan="2"| Name
 +
! colspan="2"| Type
 +
! Meaning
 +
|-
 +
| colspan="2"| Item Count
 +
| colspan="2"| {{Type|VarInt}}
 +
| The item count. Every following field is only present if this value is greater than zero.
 +
|-
 +
| colspan="2"| Item ID
 +
| colspan="2"| {{Type|Optional}} {{Type|VarInt}}
 +
| The {{Minecraft Wiki|Java Edition data values#Blocks|item ID}}. Item IDs are distinct from block IDs; see [[Data Generators]] for more information.
 +
|-
 +
| colspan="2"| Number of components to add
 +
| colspan="2"| {{Type|Optional}} {{Type|VarInt}}
 +
| Number of elements present in the first data component array
 +
|-
 +
| colspan="2"| Number of components to remove
 +
| colspan="2"| {{Type|Optional}} {{Type|VarInt}}
 +
| Number of elements present in the second data component array. This serve as a way to remove the default component values that are present on some items.
 +
|-
 +
| rowspan="2"| Components to add
 +
| Component type
 +
| rowspan="2"| {{Type|Optional}} {{Type|Array}}
 +
| {{Type|VarInt}} {{Type|Enum}}
 +
| colspan="2"| The type of component. See [[#Structured_components|Structured components]] for more detail.
 +
|-
 +
| Component data
 +
| Varies
 +
| colspan="1"| The component-dependent data. See [[#Structured_components|Structured components]] for more detail.
 +
|-
 +
| rowspan="1"| Components to remove
 +
| Component type
 +
| rowspan="1"| {{Type|Optional}} {{Type|Array}}
 +
| {{Type|VarInt}} {{Type|Enum}}
 +
| colspan="2"| The type of component. See [[#Structured_components|Structured components]] for more detail.
 +
|-
 +
|}
  
If the short (length of NBT data) is <code>-1</code>, there is no NBT data, and no further data follows. Otherwise, a byte array will follow.
+
== Structured components ==
  
The byte array contains gzipped (that is RFC 1952 rather than RFC 1950) [[NBT]] data. The format of this data is as follows:
+
The complete list of available components is described below.
  
<code>
+
For a more in-depth description, and information on how the items below are encoded with the NBT format, check [https://minecraft.wiki/w/Data_component_format here].
  COMPOUND: <nowiki>''</nowiki>
 
    LIST: 'ench'
 
      COMPOUND
 
        SHORT: 'id'
 
        SHORT: 'lvl'
 
      END
 
      COMPOUND
 
        ...etc
 
      END
 
  END
 
</code>
 
  
Each of the inner, untagged COMPOUNDs represents an enchantment, with its ID[http://www.minecraftwiki.net/wiki/Enchantment#Enchantment_Types] and level given as child SHORT elements.
+
{| class="wikitable"
 +
! Type
 +
! Name
 +
! Description
 +
! style="width: 50%" | Data
 +
|-
 +
| 0
 +
| <code>minecraft:custom_data</code>
 +
| Customizable data that doesn't fit any specific component.
 +
| As follows:
 +
  {| class="wikitable"
 +
    ! Name
 +
    ! Type
 +
    ! Description
 +
    |-
 +
    | Data
 +
    | {{Type|NBT}}
 +
    | Always a Compound Tag.
 +
    |}
 +
|-
 +
| 1
 +
| <code>minecraft:max_stack_size</code>
 +
| Maximum stack size for the item.
 +
| As follows:
 +
  {| class="wikitable"
 +
    ! Name
 +
    ! Type
 +
    ! Description
 +
    |-
 +
    | Max Stack Size
 +
    | {{Type|VarInt}}
 +
    | Ranges from 1 to 99.
 +
    |}
 +
|-
 +
| 2
 +
| <code>minecraft:max_damage</code>
 +
| The maximum damage the item can take before breaking.
 +
| As follows:
 +
  {| class="wikitable"
 +
    ! Name
 +
    ! Type
 +
    ! Description
 +
    |-
 +
    | Max Damage
 +
    | {{Type|VarInt}}
 +
    |
 +
    |}
 +
|-
 +
| 3
 +
| <code>minecraft:damage</code>
 +
| The current damage of the item.
 +
| As follows:
 +
  {| class="wikitable"
 +
    ! Name
 +
    ! Type
 +
    ! Description
 +
    |-
 +
    | Damage
 +
    | {{Type|VarInt}}
 +
    |
 +
    |}
 +
|-
 +
| 4
 +
| <code>minecraft:unbreakable</code>
 +
| Marks the item as unbreakable.
 +
| As follows:
 +
  {| class="wikitable"
 +
    ! Name
 +
    ! Type
 +
    ! Description
 +
    |-
 +
    | Show In Tooltip
 +
    | {{Type|Boolean}}
 +
    | Whether the Unbreakable indicator should be shown on the item's tooltip.
 +
    |}
 +
|-
 +
| 5
 +
| <code>minecraft:custom_name</code>
 +
| Item's custom name.<br>Normally shown in italic, and changeable at an anvil.
 +
| As follows:
 +
  {| class="wikitable"
 +
    ! Name
 +
    ! Type
 +
    ! Description
 +
    |-
 +
    | Name
 +
    | {{Type|Text Component}}
 +
    |
 +
    |}
 +
|-
 +
| 6
 +
| <code>minecraft:item_name</code>
 +
| Override for the item's default name.<br>Shown when the item has no custom name.
 +
| As follows:
 +
  {| class="wikitable"
 +
    ! Name
 +
    ! Type
 +
    ! Description
 +
    |-
 +
    | Name
 +
    | {{Type|Text Component}}
 +
    |
 +
    |}
 +
|-
 +
| 7
 +
| <code>minecraft:lore</code>
 +
| Item's lore.
 +
| As follows:
 +
  {| class="wikitable"
 +
    ! Name
 +
    ! Type
 +
    ! Description
 +
    |-
 +
    | Number of Lines
 +
    | {{Type|VarInt}}
 +
    | Number of elements in the following array.
 +
    |-
 +
    | Lines
 +
    | {{Type|Array}} of {{Type|Text Component}}
 +
    |
 +
    |}
 +
|-
 +
| 8
 +
| <code>minecraft:rarity</code>
 +
| Item's rarity.<br>This affects the default color of the item's name.
 +
| As follows:
 +
  {| class="wikitable"
 +
    ! Name
 +
    ! Type
 +
    ! Description
 +
    |-
 +
    | Rarity
 +
    | {{Type|VarInt}} {{Type|Enum}}
 +
    | Can be one of the following:
 +
* 0 - Common (white)
 +
* 1 - Uncommon (yellow)
 +
* 2 - Rare (aqua)
 +
* 3 - Epic (pink)
 +
|}
 +
|-
 +
| 9
 +
| <code>minecraft:enchantments</code>
 +
| The enchantments of the item.
 +
| As follows:
 +
  {| class="wikitable"
 +
    ! colspan="2"| Name
 +
    ! colspan="2"| Type
 +
    ! Description
 +
    |-
 +
    | colspan="2"| Number Of Enchantments
 +
    | colspan="2"| {{Type|VarInt}}
 +
    | Number of elements in the following array.
 +
    |-
 +
    | rowspan="2"| Enchantment
 +
    | Type ID
 +
    | rowspan="2"| {{Type|Array}}
 +
    | {{Type|VarInt}} {{Type|Enum}}
 +
    | The ID of the enchantment in the enchantment registry.
 +
    |-
 +
    | Level
 +
    | {{Type|VarInt}}
 +
    | The level of the enchantment.
 +
    |-
 +
    | colspan="2" | Show In Tooltip
 +
    | colspan="2" | {{Type|Boolean}}
 +
    | Whether the list of enchantments should be shown on the item's tooltip.
 +
    |}
 +
|-
 +
| 10
 +
| <code>minecraft:can_place_on</code>
 +
| List of blocks this block can be placed on when in adventure mode.
 +
| As follows:
 +
  {| class="wikitable"
 +
    ! Name
 +
    ! Type
 +
    ! Description
 +
    |-
 +
    | Number Of Predicates
 +
    | {{Type|VarInt}}
 +
    | Number of elements in the following array.
 +
    |-
 +
    | Block Predicates
 +
    | {{Type|Array}} of [[#Block_Predicate|Block Predicate]]
 +
    | See [[#Block_Predicate|Block Predicate]].
 +
    |-
 +
    | Show In Tooltip
 +
    | {{Type|Boolean}}
 +
    | Whether the Unbreakable indicator should be shown on the item's tooltip.
 +
    |}
 +
|-
 +
| 11
 +
| <code>minecraft:can_break</code>
 +
| List of blocks this item can break when in adventure mode.
 +
| As follows:
 +
  {| class="wikitable"
 +
    ! Name
 +
    ! Type
 +
    ! Description
 +
    |-
 +
    | Number Of Predicates
 +
    | {{Type|VarInt}}
 +
    | Number of elements in the following array.
 +
    |-
 +
    | Block Predicates
 +
    | {{Type|Array}} of [[#Block_Predicate|Block Predicate]]
 +
    | See [[#Block_Predicate|Block Predicate]].
 +
    |-
 +
    | Show In Tooltip
 +
    | {{Type|Boolean}}
 +
    | Whether the Unbreakable indicator should be shown on the item's tooltip.
 +
    |}
 +
|-
 +
| 12
 +
| <code>minecraft:attribute_modifiers</code>
 +
| The attribute modifiers of the item.
 +
| As follows:
 +
  {| class="wikitable"
 +
    ! colspan="2"| Name
 +
    ! colspan="2"| Type
 +
    ! Description
 +
    |-
 +
    | colspan="2"| Number Of Attributes
 +
    | colspan="2"| {{Type|VarInt}}
 +
    | Number of elements in the following array.
 +
    |-
 +
    | rowspan="6"| Attribute
 +
    | Type ID
 +
    | rowspan="6"| {{Type|Array}}
 +
    | {{Type|VarInt}} {{Type|Enum}}
 +
    | The ID of the attribute.
 +
    |-
 +
    | Unique ID
 +
    | {{Type|UUID}}
 +
    | The attribute's unique ID.
 +
    |-
 +
    | Name
 +
    | {{Type|String}}
 +
    | The attribute's name.
 +
    |-
 +
    | Value
 +
    | {{Type|Double}}
 +
    | The attribute's value.
 +
    |-
 +
    | Operation
 +
    | {{Type|VarInt}} {{Type|Enum}}
 +
    | The operation to be applied upon the value. Can be one of the following:
 +
* 0 - Add
 +
* 1 - Multiply base
 +
* 2 - Multiply total
 +
    |-
 +
    | Slot
 +
    | {{Type|VarInt}} {{Type|Enum}}
 +
    | The item slot placement required for the attribute to have effect.<br>Can be one of the following:
 +
* 0 - Any
 +
* 1 - Main hand
 +
* 2 - Off hand
 +
* 3 - Hand
 +
* 4 - Feet
 +
* 5 - Legs
 +
* 6 - Chest
 +
* 7 - Head
 +
* 8 - Armor
 +
* 9 - Body
 +
    |-
 +
    | colspan="2"| Show In Tooltip
 +
    | colspan="2"| {{Type|Boolean}}
 +
    | Whether the list of attributes should be shown on the item's tooltip.
 +
    |}
 +
|-
 +
| 13
 +
| <code>minecraft:custom_model_data</code>
 +
| Value for the item predicate when using custom item models.<br>More info can be found [https://minecraft.wiki/w/Tutorials/Models#Item_predicates here].
 +
| As follows:
 +
  {| class="wikitable"
 +
    ! Name
 +
    ! Type
 +
    ! Description
 +
    |-
 +
    | Value
 +
    | {{Type|VarInt}}
 +
    |
 +
    |}
 +
|-
 +
| 14
 +
| <code>minecraft:hide_additional_tooltip</code>
 +
| Hides the special item's tooltip of crossbow ("Projectile:"), banner pattern layers, goat horn instrument and others.
 +
| None.
 +
|-
 +
| 15
 +
| <code>minecraft:hide_tooltip</code>
 +
| Hides the item's tooltip altogether.
 +
| None.
 +
|-
 +
| 16
 +
| <code>minecraft:repair_cost</code>
 +
| Accumulated anvil usage cost. The client displays "Too Expensive" if the value is greater than 40 and the player is not in creative mode (more specifically, if they don't have the [[Protocol#Player_Abilities_(clientbound)|insta-build flag enabled]]).<br>This behavior can be overridden by setting the level with the [[Protocol#Set_Container_Property|Set Container Property]] packet.
 +
| As follows:
 +
  {| class="wikitable"
 +
    ! Name
 +
    ! Type
 +
    ! Description
 +
    |-
 +
    | Cost
 +
    | {{Type|VarInt}}
 +
    |
 +
    |}
 +
|-
 +
| 17
 +
| <code>minecraft:creative_slot_lock</code>
 +
| Marks the item as non-interactive on the creative inventory (the first 5 rows of items).<br>This is used internally by the client on the paper icon in the saved hot-bars tab.
 +
| None.
 +
|-
 +
| 18
 +
| <code>minecraft:enchantment_glint_override</code>
 +
| Overrides the item glint resulted from enchantments
 +
| As follows:
 +
  {| class="wikitable"
 +
    ! Name
 +
    ! Type
 +
    ! Description
 +
    |-
 +
    | Has Glint
 +
    | {{Type|VarInt}}
 +
    |
 +
    |}
 +
|-
 +
| 19
 +
| <code>minecraft:intangible_projectile</code>
 +
| Marks the projectile as intangible (cannot be picked-up).
 +
| None.
 +
|-
 +
| 20
 +
| <code>minecraft:food</code>
 +
| Makes the item consumable.
 +
| As follows:
 +
  {| class="wikitable"
 +
    ! colspan="2"| Name
 +
    ! colspan="2"| Type
 +
    ! Description
 +
    |-
 +
    | colspan="2"| Nutrition
 +
    | colspan="2"| {{Type|VarInt}}
 +
    | Non-negative
 +
    |-
 +
    | colspan="2"| Saturation Modifier
 +
    | colspan="2"| {{Type|Float}}
 +
    | How much saturation will be given after consuming the item.
 +
    |-
 +
    | colspan="2"| Can Always Eat
 +
    | colspan="2"| {{Type|Boolean}}
 +
    | Whether the item can always be eaten, even at full hunger.
 +
    |-
 +
    | colspan="2"| Seconds To Eat
 +
    | colspan="2"| {{Type|Float}}
 +
    | How long it takes to consume the item.
 +
    |-
 +
    | colspan="2"| Using converts to
 +
    | colspan="2"| {{Type|Slot}}
 +
    | This specifies the item produced after consuming the current item. In the Notchian server, this is used for stews, which turn into bowls. Set this to Air if the item should be consumed normally without leaving any other item after.
 +
    |-
 +
    | colspan="2"| Number of effects
 +
    | colspan="2"| {{Type|VarInt}}
 +
    | Number of elements in the following array.
 +
    |-
 +
    | rowspan="2"| Effect
 +
    | Type ID
 +
    | rowspan="2"| {{Type|Array}}
 +
    | [[#Potion_Effect|Potion Effect]]
 +
    | The potion effect. See [[#Potion_Effect|Potion Effect]].
 +
    |-
 +
    | Probability
 +
    | {{Type|Float}}
 +
    | The probability for this effect to be chosen.
 +
    |}
 +
|-
 +
| 21
 +
| <code>minecraft:fire_resistant</code>
 +
| Marks this item as fire resistant.<br>The client won't render the item as being on-fire if this component is present.
 +
| None.
 +
|-
 +
| 22
 +
| <code>minecraft:tool</code>
 +
| Alters the speed at which this item breaks certain blocks
 +
| As follows:
 +
  {| class="wikitable"
 +
    ! colspan="2"| Name
 +
    ! colspan="2"| Type
 +
    ! Description
 +
    |-
 +
    | colspan="2"| Number of Rules
 +
    | colspan="2"| {{Type|VarInt}}
 +
    | The number of elements in the following array.
 +
    |-
 +
    | rowspan="5"| Rule
 +
    | Blocks
 +
    | rowspan="5"| {{Type|Array}}
 +
    | {{Type|ID Set}}
 +
    | The blocks this rule applies to (IDs in the <code>minecraft:block</code> registry).
 +
    |-
 +
    | Has Speed
 +
    | {{Type|Boolean}}
 +
    |
 +
    |-
 +
    | Speed
 +
    | {{Type|Optional}} {{Type|Float}}
 +
    | The speed at which the tool breaks this rules' blocks. Only present if Has Speed is true.
 +
    |-
 +
    | Has Correct Drop For Blocks
 +
    | {{Type|Boolean}}
 +
    |
 +
    |-
 +
    | Correct Drop For Blocks
 +
    | {{Type|Optional}} {{Type|Boolean}}
 +
    | Whether items should drop only if this is the correct tool. Only present if Has Correct Drop For Blocks is true.
 +
    |-
 +
    | colspan="2"| Default Mining Speed
 +
    | colspan="2"| {{Type|Float}}
 +
    | The mining speed in case none of the previous rule were matched.
 +
    |-
 +
    | colspan="2"| Damage Per Block
 +
    | colspan="2"| {{Type|VarInt}}
 +
    | The amount of damage the item takes per block break.
 +
    |}
 +
|-
 +
| 23
 +
| <code>minecraft:stored_enchantments</code>
 +
| The enchantments stored in this enchanted book.
 +
| As follows:
 +
  {| class="wikitable"
 +
    ! colspan="2"| Name
 +
    ! colspan="2"| Type
 +
    ! Description
 +
    |-
 +
    | colspan="2"| Number of enchantments
 +
    | colspan="2"| {{Type|VarInt}}
 +
    | Number of elements in the following array.
 +
    |-
 +
    | rowspan="2"| Enchantment
 +
    | Type ID
 +
    | rowspan="2"| {{Type|Array}}
 +
    | {{Type|VarInt}} {{Type|Enum}}
 +
    | The ID of the enchantment in the enchantment registry.
 +
    |-
 +
    | Level
 +
    | {{Type|VarInt}}
 +
    | The level of the enchantment.
 +
    |-
 +
    | colspan="2"| Show In Tooltip
 +
    | colspan="2"| {{Type|Boolean}}
 +
    | Whether the list of enchantments should be shown on the item's tooltip.
 +
    |}
 +
|-
 +
| 24
 +
| <code>minecraft:dyed_color</code>
 +
| Color of dyed leather armor.
 +
| As follows:
 +
  {| class="wikitable"
 +
    ! Name
 +
    ! Type
 +
    ! Description
 +
    |-
 +
    | Color
 +
    | {{Type|Int}}
 +
    | The RGB components of the color, encoded as an integer.
 +
    |-
 +
    | Show In Tooltip
 +
    | {{Type|Boolean}}
 +
    | Whether the armor's color should be shown on the item's tooltip.
 +
    |}
 +
|-
 +
| 25
 +
| <code>minecraft:map_color</code>
 +
| Color of the markings on the map item model.
 +
| As follows:
 +
  {| class="wikitable"
 +
    ! Name
 +
    ! Type
 +
    ! Description
 +
    |-
 +
    | Color
 +
    | {{Type|Int}}
 +
    | The RGB components of the color, encoded as an integer.
 +
    |}
 +
|-
 +
| 26
 +
| <code>minecraft:map_id</code>
 +
| The ID of the map.
 +
| As follows:
 +
  {| class="wikitable"
 +
    ! Name
 +
    ! Type
 +
    ! Description
 +
    |-
 +
    | ID
 +
    | {{Type|VarInt}}
 +
    |
 +
    |}
 +
|-
 +
| 27
 +
| <code>minecraft:map_decorations</code>
 +
| Icons present on a map.
 +
| As follows:
 +
  {| class="wikitable"
 +
    ! Name
 +
    ! Type
 +
    ! Description
 +
    |-
 +
    | Data
 +
    | {{Type|NBT}}
 +
    | Always a Compound Tag.
 +
    |}
 +
|-
 +
| 28
 +
| <code>minecraft:map_post_processing</code>
 +
| Used internally by the client when expanding or locking a map. Display extra information on the item's tooltip when the component is present.
 +
| As follows:
 +
  {| class="wikitable"
 +
    ! Name
 +
    ! Type
 +
    ! Description
 +
    |-
 +
    | Type
 +
    | {{Type|VarInt}} {{Type|Enum}}
 +
    | Type of post processing. Can be either:
 +
* 0 - Lock
 +
* 1 - Scale
 +
    |}
 +
|-
 +
| 29
 +
| <code>minecraft:charged_projectiles</code>
 +
| Projectiles loaded into a charged crossbow.
 +
| As follows:
 +
  {| class="wikitable"
 +
    ! Name
 +
    ! Type
 +
    ! Description
 +
    |-
 +
    | Number Of Projectiles
 +
    | {{Type|VarInt}}
 +
    | The number of elements in the following array.
 +
    |-
 +
    | Projectiles
 +
    | {{Type|Array}} of {{Type|Slot}}
 +
    | The projectiles.
 +
    |}
 +
|-
 +
| 30
 +
| <code>minecraft:bundle_contents</code>
 +
| Contents of a bundle.
 +
| As follows:
 +
  {| class="wikitable"
 +
    ! Name
 +
    ! Type
 +
    ! Description
 +
    |-
 +
    | Number Of Items
 +
    | {{Type|VarInt}}
 +
    | The number of elements in the following array.
 +
    |-
 +
    | Items
 +
    | {{Type|Array}} of {{Type|Slot}}
 +
    | The projectiles.
 +
    |}
 +
|-
 +
| 31
 +
| <code>minecraft:potion_contents</code>
 +
| Visual and effects of a potion item.
 +
| As follows:
 +
  {| class="wikitable"
 +
    ! Name
 +
    ! Type
 +
    ! Description
 +
    |-
 +
    | Has Potion ID
 +
    | {{Type|Boolean}}
 +
    | Whether this potion has an ID in the potion registry. If true, it has the default effects associated with the potion type.
 +
    |-
 +
    | Potion ID
 +
    | {{Type|Optional}} {{Type|VarInt}}
 +
    | The ID of the potion type in the potion registry. Only present if Has Potion ID is true.
 +
    |-
 +
    | Has Custom Color
 +
    | {{Type|Boolean}}
 +
    | Whether this potion has a custom color. If false, it uses the default color associated with the potion type.
 +
    |-
 +
    | Custom Color
 +
    | {{Type|Optional}} {{Type|Int}}
 +
    | The RGB components of the color, encoded as an integer. Only present if Has Custom Color is true.
 +
    |-
 +
    | Number Of Custom Effects
 +
    | {{Type|VarInt}}
 +
    | The number of elements in the following array.
 +
    |-
 +
    | Custom Effects
 +
    | {{Type|Array}} of [[#Potion_Effect|Potion Effect]]
 +
    | Any custom effects the potion might have. See [[#Potion_Effect|Potion Effect]].
 +
    |}
 +
|-
 +
| 32
 +
| <code>minecraft:suspicious_stew_effects</code>
 +
| Effects granted by a suspicious stew.
 +
| As follows:
 +
  {| class="wikitable"
 +
    ! colspan="2"| Name
 +
    ! colspan="2"| Type
 +
    ! Description
 +
    |-
 +
    | colspan="2"| Number Of Effects
 +
    | colspan="2"| {{Type|VarInt}}
 +
    | Number of elements in the following array.
 +
    |-
 +
    | rowspan="2"| Effect
 +
    | Type ID
 +
    | rowspan="2"| {{Type|Array}}
 +
    | {{Type|VarInt}} {{Type|Enum}}
 +
    | The ID of the effect in the potion effect type registry.
 +
    |-
 +
    | Duration
 +
    | {{Type|VarInt}}
 +
    | The duration of the effect.
 +
    |}
 +
|-
 +
| 33
 +
| <code>minecraft:writable_book_content</code>
 +
| Content of a writable book.
 +
| As follows:
 +
  {| class="wikitable"
 +
    ! colspan="2"| Name
 +
    ! colspan="2"| Type
 +
    ! Description
 +
    |-
 +
    | colspan="2"| Number Of Pages
 +
    | colspan="2"| {{Type|VarInt}}
 +
    | Number of elements in the following array.
 +
    |-
 +
    | rowspan="3"| Page
 +
    | Raw Content
 +
    | rowspan="3"| {{Type|Array}} (100)
 +
    | {{Type|String}} (1024)
 +
    | The raw text of the page.
 +
    |-
 +
    | Has Filtered Content
 +
    | {{Type|Boolean}}
 +
    |
 +
    |-
 +
    | Filtered Content
 +
    | {{Type|Optional}} {{Type|String}} (1024)
 +
    | The content after passing through chat filters. Only present if Has Filtered Content is true.
 +
    |}
 +
|-
 +
| 34
 +
| <code>minecraft:written_book_content</code>
 +
| Content of a written and signed book.
 +
| As follows:
 +
  {| class="wikitable"
 +
    ! colspan="2"| Name
 +
    ! colspan="2"| Type
 +
    ! Description
 +
    |-
 +
    | colspan="2"| Raw Title
 +
    | colspan="2"| {{Type|String}} (32)
 +
    | The raw title of the book.
 +
    |-
 +
    | colspan="2"| Has Filtered Title
 +
    | colspan="2"| {{Type|Boolean}}
 +
    |
 +
    |-
 +
    | colspan="2"| Filtered Title
 +
    | colspan="2"| {{Type|Optional}} {{Type|String}} (32)
 +
    | The title after going through chat filters. Only present if Has Filtered Title is true.
 +
    |-
 +
    | colspan="2"| Author
 +
    | colspan="2"| {{Type|String}}
 +
    |
 +
    |-
 +
    | colspan="2"| Generation
 +
    | colspan="2"| {{Type|VarInt}}
 +
    |
 +
    |-
 +
    | colspan="2"| Number Of Pages
 +
    | colspan="2"| {{Type|VarInt}}
 +
    | Number of elements in the following array.
 +
    |-
 +
    | rowspan="3"| Page
 +
    | Raw Content
 +
    | rowspan="3"| {{Type|Array}} (100)
 +
    | {{Type|TextComponent}} (1024)
 +
    | The raw text of the page.
 +
    |-
 +
    | Has Filtered Content
 +
    | {{Type|Boolean}}
 +
    |
 +
    |-
 +
    | Filtered Content
 +
    | {{Type|Optional}} {{Type|Text Component}} (1024)
 +
    | The content after passing through chat filters. Only present if Has Filtered Content is true.
 +
    |-
 +
    | colspan="2"| Resolved
 +
    | colspan="2"| {{Type|Boolean}}
 +
    | Whether entity selectors have already been resolved.
 +
    |}
 +
|-
 +
| 35
 +
| <code>minecraft:trim</code>
 +
| Armor's trim pattern and color
 +
| As follows:
 +
  {| class="wikitable"
 +
    ! Name
 +
    ! Type
 +
    ! Description
 +
    |-
 +
    | Trim Material
 +
    | {{Type|ID or}} [[#Trim Material|Trim Material]]
 +
    | ID in the <code>minecraft:trim_material</code> registry, or an inline definition.
 +
    |-
 +
    | Trim Pattern
 +
    | {{Type|ID or}} [[#Trim Pattern|Trim Pattern]]
 +
    | ID in the <code>minecraft:trim_pattern</code> registry, or an inline definition.
 +
    |-
 +
    | Show In Tooltip
 +
    | {{Type|Boolean}}
 +
    | Whether the trim information should be shown on the item's tooltip.
 +
    |}
 +
|-
 +
| 36
 +
| <code>minecraft:debug_stick_state</code>
 +
| State of the debug stick
 +
| As follows:
 +
  {| class="wikitable"
 +
    ! Name
 +
    ! Type
 +
    ! Description
 +
    |-
 +
    | Data
 +
    | {{Type|NBT}}
 +
    | States of previously interacted blocks. Always a Compound Tag.
 +
    |}
 +
|-
 +
| 37
 +
| <code>minecraft:entity_data</code>
 +
| Data for the entity to be created from this item.
 +
| As follows:
 +
  {| class="wikitable"
 +
    ! Name
 +
    ! Type
 +
    ! Description
 +
    |-
 +
    | Data
 +
    | {{Type|NBT}}
 +
    | Always a Compound Tag.
 +
    |}
 +
|-
 +
| 38
 +
| <code>minecraft:bucket_entity_data</code>
 +
| Data of the entity contained in this bucket.
 +
| As follows:
 +
  {| class="wikitable"
 +
    ! Name
 +
    ! Type
 +
    ! Description
 +
    |-
 +
    | Data
 +
    | {{Type|NBT}}
 +
    | Always a Compound Tag.
 +
    |}
 +
|-
 +
| 39
 +
| <code>minecraft:block_entity_data</code>
 +
| Data of the block entity to be created from this item.
 +
| As follows:
 +
  {| class="wikitable"
 +
    ! Name
 +
    ! Type
 +
    ! Description
 +
    |-
 +
    | Data
 +
    | {{Type|NBT}}
 +
    | Always a Compound Tag.
 +
    |}
 +
|-
 +
| 40
 +
| <code>minecraft:instrument</code>
 +
| The sound played when using a goat horn.
 +
| As follows:
 +
  {| class="wikitable"
 +
    ! Name
 +
    ! Type
 +
    ! Description
 +
    |-
 +
    | Instrument
 +
    | {{Type|Id or}} [[#Instrument|Instrument]]
 +
    | ID in the <code>minecraft:instrument</code> registry, or an inline definition.
 +
    |}
 +
|-
 +
| 41
 +
| <code>minecraft:ominous_bottle_amplifier</code>
 +
| Amplifier for the effect of an ominous bottle.
 +
| As follows:
 +
  {| class="wikitable"
 +
    ! Name
 +
    ! Type
 +
    ! Description
 +
    |-
 +
    | Amplifier
 +
    | {{Type|VarInt}}
 +
    | Between 0 and 4.
 +
    |}
 +
|-
 +
| 42
 +
| <code>minecraft:jukebox_playable</code>
 +
| The song this item will play when inserted into a jukebox.<br>{{Warning2|The Notchian client assumes that the server will always represent the jukebox song either by name, or reference an entry on its respective registry. Trying to directly specify a jukebox song (when <code>Jukebox Song Type</code> is 0) will cause the client to fail to parse it and subsequently disconnect, which is likely an unintended bug.}}
 +
| As follows:
 +
  {| class="wikitable"
 +
    ! Name
 +
    ! Type
 +
    ! Description
 +
    |-
 +
    | Direct Mode
 +
    | {{Type|Boolean}}
 +
    | Whether the jukebox song is specified directly, or just referenced by name.
 +
    |-
 +
    | Jukebox Song Name
 +
    | {{Type|Optional}} {{Type|Identifier}}
 +
    | The name of the jukebox song in its respective registry. Only present if Direct Mode is false.
 +
    |-
 +
    | Jukebox Song
 +
    | {{Type|Optional}} {{Type|ID or}} [[#Jukebox Song|Jukebox Song]]
 +
    | ID in the <code>minecraft:jukebox_song</code> registry. Only present if Direct Mode is true.
 +
    |-
 +
    | Show In Tooltip
 +
    | {{Type|Boolean}}
 +
    | Whether the song should be shown on the item's tooltip.
 +
    |}
 +
|-
 +
| 43
 +
| <code>minecraft:recipes</code>
 +
| The recipes this knowledge book unlocks.
 +
| As follows:
 +
  {| class="wikitable"
 +
    ! Name
 +
    ! Type
 +
    ! Description
 +
    |-
 +
    | Data
 +
    | {{Type|NBT}}
 +
    | Always a Compound Tag.
 +
    |}
 +
|-
 +
| 44
 +
| <code>minecraft:lodestone_tracker</code>
 +
| The lodestone this compass points to.
 +
| As follows:
 +
  {| class="wikitable"
 +
    ! Name
 +
    ! Type
 +
    ! Description
 +
    |-
 +
    | Has Global Position
 +
    | {{Type|Boolean}}
 +
    | Whether this lodestone points to a position, otherwise it spins randomly.
 +
    |-
 +
    | Dimension
 +
    | {{Type|Identifier}}
 +
    | The dimension the compass points to. Only present if Has Global Position is true.
 +
    |-
 +
    | Position
 +
    | {{Type|Position}}
 +
    | The position the compass points to. Only present if Has Global Position is true.
 +
    |-
 +
    | Tracked
 +
    | {{Type|Boolean}}
 +
    | Whether the component is removed when the associated lodestone is broken.
 +
    |}
 +
|-
 +
| 45
 +
| <code>minecraft:firework_explosion</code>
 +
| Properties of a firework star.
 +
| As follows:
 +
  {| class="wikitable"
 +
    ! Name
 +
    ! Type
 +
    ! Description
 +
    |-
 +
    | Explosion
 +
    | [[#Firework_Explosion|Firework Explosion]]
 +
    | See [[#Firework_Explosion|Firework Explosion]].
 +
    |}
 +
|-
 +
| 46
 +
| <code>minecraft:fireworks</code>
 +
| Properties of a firework.
 +
| As follows:
 +
  {| class="wikitable"
 +
    ! Name
 +
    ! Type
 +
    ! Description
 +
    |-
 +
    | Flight Duration
 +
    | {{Type|VarInt}}
 +
    |
 +
    |-
 +
    | Number Of Explosions
 +
    | {{Type|VarInt}}
 +
    | Number of elements in the following array.
 +
    |-
 +
    | Explosions
 +
    | {{Type|Array}} of [[#Firework_Explosion|Firework Explosion]]
 +
    | See [[#Firework_Explosion|Firework Explosion]].
 +
    |}
 +
|-
 +
| 47
 +
| <code>minecraft:profile</code>
 +
| Game Profile of a player's head.
 +
| As follows:
 +
  {| class="wikitable"
 +
    ! colspan="2"| Name
 +
    ! colspan="2"| Type
 +
    ! Description
 +
    |-
 +
    | colspan="2"| Has Name
 +
    | colspan="2"| {{Type|Boolean}}
 +
    |
 +
    |-
 +
    | colspan="2"| Name
 +
    | colspan="2"| {{Type|Optional}} {{Type|String}} (16)
 +
    | Only present if Has Name is true.
 +
    |-
 +
    | colspan="2"| Has Unique ID
 +
    | colspan="2"| {{Type|Boolean}}
 +
    |
 +
    |-
 +
    | colspan="2"| Unique ID
 +
    | colspan="2"| {{Type|Optional}} {{Type|UUID}}
 +
    | Only present if Has Unique ID is true.
 +
    |-
 +
    | colspan="2"| Number of Properties
 +
    | colspan="2"| {{Type|VarInt}}
 +
    | Number of elements in the following array.
 +
    |-
 +
    | rowspan="4"| Property
 +
    | Name
 +
    | rowspan="4"| {{Type|Array}}
 +
    | {{Type|String}} (64)
 +
    |
 +
    |-
 +
    | Value
 +
    | {{Type|String}}
 +
    |
 +
    |-
 +
    | Has Signature
 +
    | {{Type|Boolean}}
 +
    |
 +
    |-
 +
    | Signature
 +
    | {{Type|String}} (1024)
 +
    | Only present if Has Signature is true.
 +
    |}
 +
|-
 +
| 48
 +
| <code>minecraft:note_block_sound</code>
 +
| Sound played by a note block when this player's head is placed on top of it.
 +
| As follows:
 +
  {| class="wikitable"
 +
    ! Name
 +
    ! Type
 +
    ! Description
 +
    |-
 +
    | Sound
 +
    | {{Type|Identifier}}
 +
    |
 +
    |}
 +
|-
 +
| 49
 +
| <code>minecraft:banner_patterns</code>
 +
| Patterns of a banner or banner applied to a shield.
 +
| As follows:
 +
  {| class="wikitable"
 +
    ! colspan="2"| Name
 +
    ! colspan="2"| Type
 +
    ! Description
 +
    |-
 +
    | colspan="2" | Number of Layers
 +
    | colspan="2" | {{Type|VarInt}}
 +
    | colspan="2" | Number of elements in the following array.
 +
    |-
 +
    | rowspan="4"| Layer
 +
    | Pattern Type
 +
    | rowspan="4"| {{Type|Array}}
 +
    | {{Type|VarInt}}
 +
    | Identifier used to determine the data that follows. It can be either:
 +
* 0 - Directly represents a pattern, with the necessary data following.
 +
* Anything else - References a pattern in its registry, by the ID of <code>Pattern Type - 1</code>.
 +
    |-
 +
    | Asset ID
 +
    | {{Type|Optional}} {{Type|Identifier}}
 +
    | Identifier of the asset. Only present if Pattern Type is 0.
 +
    |-
 +
    | Translation Key
 +
    | {{Type|Optional}} {{Type|String}}
 +
    | Only present if Pattern Type is 0.
 +
    |-
 +
    | Color
 +
    | [[#Dye_Color|Dye Color]]
 +
    | See [[#Dye_Color|Dye Color]].
 +
    |}
 +
|-
 +
| 50
 +
| <code>minecraft:base_color</code>
 +
| Base color of the banner applied to a shield.
 +
| As follows:
 +
  {| class="wikitable"
 +
    ! Name
 +
    ! Type
 +
    ! Description
 +
    |-
 +
    | Color
 +
    | [[#Dye_Color|Dye Color]]
 +
    | See [[#Dye_Color|Dye Color]].
 +
    |}
 +
|-
 +
| 51
 +
| <code>minecraft:pot_decorations</code>
 +
| Decorations on the four sides of a pot.
 +
| As follows:
 +
  {| class="wikitable"
 +
    ! Name
 +
    ! Type
 +
    ! Description
 +
    |-
 +
    | Number Of Decorations
 +
    | {{Type|VarInt}}
 +
    | The number of elements in the following array.
 +
    |-
 +
    | Decorations
 +
    | {{Type|Array}} (4) of {{Type|VarInt}} {{Type|Enum}}
 +
    | The ID of the items in the item registry.
 +
    |}
 +
|-
 +
| 52
 +
| <code>minecraft:container</code>
 +
| Items inside a container of any type.
 +
| As follows:
 +
  {| class="wikitable"
 +
    ! Name
 +
    ! Type
 +
    ! Description
 +
    |-
 +
    | Number Of Items
 +
    | {{Type|VarInt}}
 +
    | The number of elements in the following array.
 +
    |-
 +
    | Items
 +
    | {{Type|Array}} (256) of {{Type|Slot}}
 +
    |
 +
    |}
 +
|-
 +
| 53
 +
| <code>minecraft:block_state</code>
 +
| State of a block.
 +
| As follows:
 +
  {| class="wikitable"
 +
    ! colspan="2"| Name
 +
    ! colspan="2"| Type
 +
    ! Description
 +
    |-
 +
    | colspan="2" | Number of Properties
 +
    | colspan="2" | {{Type|VarInt}}
 +
    | colspan="2" | Number of elements in the following array.
 +
    |-
 +
    | rowspan="2"| Property
 +
    | Name
 +
    | rowspan="2"| {{Type|Array}}
 +
    | {{Type|String}}
 +
    |
 +
    |-
 +
    | Value
 +
    | {{Type|String}}
 +
    |
 +
    |}
 +
|-
 +
| 54
 +
| <code>minecraft:bees</code>
 +
| Bees inside a hive.
 +
| As follows:
 +
  {| class="wikitable"
 +
    ! colspan="2"| Name
 +
    ! colspan="2"| Type
 +
    ! Description
 +
    |-
 +
    | colspan="2" | Number of Bees
 +
    | colspan="2" | {{Type|VarInt}}
 +
    | colspan="2" | Number of elements in the following array.
 +
    |-
 +
    | rowspan="3"| Bee
 +
    | Entity Data
 +
    | rowspan="3"| {{Type|Array}}
 +
    | {{Type|NBT}}
 +
    | Custom data for the entity, always a Compound Tag. Same structure as the <code>minecraft:custom_data</code> component.
 +
    |-
 +
    | Ticks In Hive
 +
    | {{Type|VarInt}}
 +
    |
 +
    |-
 +
    | Min Ticks In Hive
 +
    | {{Type|VarInt}}
 +
    |
 +
    |}
 +
|-
 +
| 55
 +
| <code>minecraft:lock</code>
 +
| Name of the necessary key to open this container.
 +
| As follows:
 +
  {| class="wikitable"
 +
    ! Name
 +
    ! Type
 +
    ! Description
 +
    |-
 +
    | Key
 +
    | {{Type|NBT}}
 +
    | Always a String Tag.
 +
    |}
 +
|-
 +
| 56
 +
| <code>minecraft:container_loot</code>
 +
| Loot table for an unopened container.
 +
| As follows:
 +
  {| class="wikitable"
 +
    ! Name
 +
    ! Type
 +
    ! Description
 +
    |-
 +
    | Data
 +
    | {{Type|NBT}}
 +
    | Always a Compound Tag.
 +
    |}
 +
|}
  
== Examples ==
+
== Other types ==
  
<code>
+
Common types used in multiple components are described below.
  ff ff                            | empty slot
+
 
  01 16 01 00 00 ff ff            | a diamond pickaxe
+
=== Block Predicate ===
  01 16 01 00 00 00 04 CA FE BA BE | a diamond pickaxe with (made-up) NBT data
+
 
</code>
+
Describes a predicate used when block filtering is necessary. It can be parameterized to account for the type of block, the values of specific block state properties, NBT data related to block entities, or any combination of the three.
 +
 
 +
{| class="wikitable"
 +
! Name
 +
! Type
 +
! Description
 +
|-
 +
| Has Blocks
 +
| {{Type|Boolean}}
 +
| Whether this predicate is tied to specific types of blocks.
 +
|-
 +
| Blocks
 +
| {{Type|Optional}} {{Type|ID Set}}
 +
| IDs in the <code>minecraft:block</code> registry. Only present if Has Blocks is true.
 +
|-
 +
| Has Properties
 +
| {{Type|Boolean}}
 +
| Whether this predicate is tied to specific properties of a block.
 +
|-
 +
| Number of Properties
 +
| {{Type|Optional}} {{Type|VarInt}}
 +
| Number of elements in the following array. Only present if Has Properties is true.
 +
|-
 +
| Properties
 +
| {{Type|Optional}} {{Type|Array}} of Property
 +
| See Property structure below. Only present if Has Properties is true.
 +
|-
 +
| Has NBT
 +
| {{Type|Boolean}}
 +
| Whether this predicate is tied to specific block entity data.
 +
|-
 +
| NBT
 +
| {{Type|Optional}} {{Type|NBT}}
 +
| Only present is Has NBT is true.
 +
|}
 +
 
 +
The Property structure is defined as follows:
 +
 
 +
{| class="wikitable"
 +
! Name
 +
! Type
 +
! Description
 +
|-
 +
| Name
 +
| {{Type|String}}
 +
| Name of the block state property.
 +
|-
 +
| Is Exact Match
 +
| {{Type|Boolean}}
 +
| Whether this is an exact value match, as opposed to ranged.
 +
|-
 +
| Exact Value
 +
| {{Type|Optional }} {{Type|String}}
 +
| Value of the block state property. Only present in exact match mode.
 +
|-
 +
| Min Value
 +
| {{Type|Optional}} {{Type|String}}
 +
| Minimum value of the block state property range. Only present in ranged match mode.
 +
|-
 +
| Max Value
 +
| {{Type|Optional}} {{Type|String}}
 +
| Maximum value of the block state property range. Only present in ranged match mode.
 +
|}
 +
 
 +
=== Dye Color ===
 +
 
 +
A color from one of the 16 dye types.
 +
 
 +
{| class="wikitable"
 +
! Name
 +
! Type
 +
! Description
 +
|-
 +
| Color
 +
| {{Type|VarInt}} {{Type|Enum}}
 +
| Can be one of the following:
 +
* 0 - White
 +
* 1 - Orange
 +
* 2 - Magenta
 +
* 3 - Light Blue
 +
* 4 - Yellow
 +
* 5 - Lime
 +
* 6 - Pink
 +
* 7 - Gray
 +
* 8 - Light Gray
 +
* 9 - Cyan
 +
* 10 - Purple
 +
* 11 - Blue
 +
* 12 - Brown
 +
* 13 - Green
 +
* 14 - Red
 +
* 15 - Black
 +
|}
 +
 
 +
=== Firework Explosion ===
 +
 
 +
Represents a firework explosion, consisting of a shape, colors, and extra details.
 +
 
 +
{| class="wikitable"
 +
! Name
 +
! Type
 +
! Description
 +
|-
 +
| Shape
 +
| {{Type|VarInt}} {{Type|Enum}}
 +
| Can be one of the following:
 +
* 0 - Small ball
 +
* 1 - Large ball
 +
* 2 - Star
 +
* 3 - Creeper
 +
* 4 - Burst
 +
|-
 +
| Number Of Colors
 +
| {{Type|VarInt}}
 +
| The number of elements in the following array.
 +
|-
 +
| Colors
 +
| {{Type|Array}} of {{Type|Int}}
 +
| The RGB components of the color, encoded as an integer.
 +
|-
 +
| Number Of Fade Colors
 +
| {{Type|VarInt}}
 +
| The number of elements in the following array.
 +
|-
 +
| Fade Colors
 +
| {{Type|Array}} of {{Type|Int}}
 +
| The RGB components of the color, encoded as an integer.
 +
|-
 +
| Has Trail
 +
| {{Type|Boolean}}
 +
|
 +
|-
 +
| Has Twinkle
 +
| {{Type|Boolean}}
 +
|
 +
|}
 +
 
 +
=== Potion Effect ===
 +
 
 +
Describes all the aspects of a potion effect.
 +
 
 +
{| class="wikitable"
 +
! Name
 +
! Type
 +
! Description
 +
|-
 +
| Type ID
 +
| {{Type|VarInt}} {{Type|Enum}}
 +
| The ID of the effect in the potion effect type registry.
 +
|-
 +
| Details
 +
| Detail
 +
| See Detail structure below.
 +
|}
 +
 
 +
The Detail structure is defined as follows:
 +
 
 +
{| class="wikitable"
 +
! Name
 +
! Type
 +
! Description
 +
|-
 +
| Amplifier
 +
| {{Type|VarInt}}
 +
|
 +
|-
 +
| Duration
 +
| {{Type|VarInt}}
 +
| -1 for infinite.
 +
|-
 +
| Ambient
 +
| {{Type|Boolean}}
 +
| Produces more translucent particle effects if true.
 +
|-
 +
| Show Particles
 +
| {{Type|Boolean}}
 +
| Completely hides effect particles if false.
 +
|-
 +
| Show Icon
 +
| {{Type|Boolean}}
 +
| Shows the potion icon in the inventory screen if true.
 +
|-
 +
| Has Hidden Effect
 +
| {{Type|Boolean}}
 +
| Used to store the state of the previous potion effect when a stronger one is applied. This guarantees that the weaker one will persist, in case it lasts longer.
 +
{{Need Info|This behavior seems to be entirely server-sided. Does the presence of this field actually has any noticeable impact on the client?}}
 +
|-
 +
| Hidden Effect
 +
| {{Type|Optional}} Detail
 +
| Only present if Has Hidden Effect is true.
 +
|}
 +
 
 +
=== Trim Material ===
 +
 
 +
{{See also|Registry_Data#Armor Trim Material}}
 +
 
 +
{| class="wikitable"
 +
! colspan="2"| Name
 +
! colspan="2"| Type
 +
! Description
 +
|-
 +
| colspan="2"| Asset Name
 +
| colspan="2"| {{Type|String}}
 +
|
 +
|-
 +
| colspan="2"| Ingredient
 +
| colspan="2"| {{Type|VarInt}}
 +
|
 +
|-
 +
| colspan="2"| Item Model Index
 +
| colspan="2"| {{Type|Float}}
 +
|
 +
|-
 +
| colspan="2"| Number of Overrides
 +
| colspan="2"| {{Type|VarInt}}
 +
|
 +
|-
 +
| rowspan="2"| Override
 +
| Armor Material Type
 +
| rowspan="2"| {{Type|Array}}
 +
| {{Type|VarInt}} {{Type|Enum}}
 +
|
 +
|-
 +
| Overriden Asset Name
 +
| {{Type|String}}
 +
|
 +
|-
 +
| colspan="2"| Description
 +
| colspan="2"| {{Type|Text Component}}
 +
|}
 +
 
 +
=== Trim Pattern ===
 +
 
 +
{{See also|Registry_Data#Armor Trim Pattern}}
 +
 
 +
{| class="wikitable"
 +
! Name
 +
! Type
 +
! Description
 +
|-
 +
| Asset Name
 +
| {{Type|String}}
 +
|
 +
|-
 +
| Template Item
 +
| {{Type|VarInt}}
 +
|
 +
|-
 +
| Description
 +
| {{Type|Text Component}}
 +
|
 +
|-
 +
| Decal
 +
| {{Type|Boolean}}
 +
|
 +
|}
 +
 
 +
=== Instrument ===
 +
 
 +
{| class="wikitable"
 +
! Name
 +
! Type
 +
! Description
 +
|-
 +
| Sound Event
 +
| {{Type|Id or}} {{Type|Sound Event}}
 +
| The sound to be played.
 +
|-
 +
| Use duration
 +
| {{Type|VarInt}}
 +
| The maximum range of the sound.
 +
|-
 +
| Range
 +
| {{Type|Float}}
 +
| The range of the instrument.
 +
|}
 +
 
 +
=== Jukebox Song ===
 +
 
 +
{| class="wikitable"
 +
! Name
 +
! Type
 +
! Description
 +
|-
 +
| Sound Event
 +
| {{Type|Optional}} {{Type|Id or}} {{Type|Sound Event}}
 +
| The sound to be played.
 +
|-
 +
| Description
 +
| {{Type|Optional}} {{Type|Text Component}}
 +
| The description shown in the item lore.
 +
|-
 +
| Duration
 +
| {{Type|Optional}} {{Type|Float}}
 +
| The duration the songs should play for, in seconds.
 +
|-
 +
| Output
 +
| {{Type|Optional}} {{Type|VarInt}}
 +
| The output strength given by a comparator. Between 0 and 15.
 +
|-
  
 
[[Category:Protocol Details]]
 
[[Category:Protocol Details]]
 
[[Category:Minecraft Modern]]
 
[[Category:Minecraft Modern]]

Latest revision as of 03:32, 23 November 2024

The Slot data structure defines how an item is represented when inside an inventory window of any kind, such as a chest or furnace.

This page presents the new Slot data structure, using structured components. You can find the documentation of the old structure, that utilizes raw NBT data, here.

Format

Name Type Meaning
Item Count VarInt The item count. Every following field is only present if this value is greater than zero.
Item ID Optional VarInt The item ID. Item IDs are distinct from block IDs; see Data Generators for more information.
Number of components to add Optional VarInt Number of elements present in the first data component array
Number of components to remove Optional VarInt Number of elements present in the second data component array. This serve as a way to remove the default component values that are present on some items.
Components to add Component type Optional Array VarInt Enum The type of component. See Structured components for more detail.
Component data Varies The component-dependent data. See Structured components for more detail.
Components to remove Component type Optional Array VarInt Enum The type of component. See Structured components for more detail.

Structured components

The complete list of available components is described below.

For a more in-depth description, and information on how the items below are encoded with the NBT format, check here.

Type Name Description Data
0 minecraft:custom_data Customizable data that doesn't fit any specific component. As follows:
Name Type Description
Data NBT Always a Compound Tag.
1 minecraft:max_stack_size Maximum stack size for the item. As follows:
Name Type Description
Max Stack Size VarInt Ranges from 1 to 99.
2 minecraft:max_damage The maximum damage the item can take before breaking. As follows:
Name Type Description
Max Damage VarInt
3 minecraft:damage The current damage of the item. As follows:
Name Type Description
Damage VarInt
4 minecraft:unbreakable Marks the item as unbreakable. As follows:
Name Type Description
Show In Tooltip Boolean Whether the Unbreakable indicator should be shown on the item's tooltip.
5 minecraft:custom_name Item's custom name.
Normally shown in italic, and changeable at an anvil.
As follows:
Name Type Description
Name Text Component
6 minecraft:item_name Override for the item's default name.
Shown when the item has no custom name.
As follows:
Name Type Description
Name Text Component
7 minecraft:lore Item's lore. As follows:
Name Type Description
Number of Lines VarInt Number of elements in the following array.
Lines Array of Text Component
8 minecraft:rarity Item's rarity.
This affects the default color of the item's name.
As follows:
Name Type Description
Rarity VarInt Enum Can be one of the following:
  • 0 - Common (white)
  • 1 - Uncommon (yellow)
  • 2 - Rare (aqua)
  • 3 - Epic (pink)
9 minecraft:enchantments The enchantments of the item. As follows:
Name Type Description
Number Of Enchantments VarInt Number of elements in the following array.
Enchantment Type ID Array VarInt Enum The ID of the enchantment in the enchantment registry.
Level VarInt The level of the enchantment.
Show In Tooltip Boolean Whether the list of enchantments should be shown on the item's tooltip.
10 minecraft:can_place_on List of blocks this block can be placed on when in adventure mode. As follows:
Name Type Description
Number Of Predicates VarInt Number of elements in the following array.
Block Predicates Array of Block Predicate See Block Predicate.
Show In Tooltip Boolean Whether the Unbreakable indicator should be shown on the item's tooltip.
11 minecraft:can_break List of blocks this item can break when in adventure mode. As follows:
Name Type Description
Number Of Predicates VarInt Number of elements in the following array.
Block Predicates Array of Block Predicate See Block Predicate.
Show In Tooltip Boolean Whether the Unbreakable indicator should be shown on the item's tooltip.
12 minecraft:attribute_modifiers The attribute modifiers of the item. As follows:
Name Type Description
Number Of Attributes VarInt Number of elements in the following array.
Attribute Type ID Array VarInt Enum The ID of the attribute.
Unique ID UUID The attribute's unique ID.
Name String The attribute's name.
Value Double The attribute's value.
Operation VarInt Enum The operation to be applied upon the value. Can be one of the following:
  • 0 - Add
  • 1 - Multiply base
  • 2 - Multiply total
Slot VarInt Enum The item slot placement required for the attribute to have effect.
Can be one of the following:
  • 0 - Any
  • 1 - Main hand
  • 2 - Off hand
  • 3 - Hand
  • 4 - Feet
  • 5 - Legs
  • 6 - Chest
  • 7 - Head
  • 8 - Armor
  • 9 - Body
Show In Tooltip Boolean Whether the list of attributes should be shown on the item's tooltip.
13 minecraft:custom_model_data Value for the item predicate when using custom item models.
More info can be found here.
As follows:
Name Type Description
Value VarInt
14 minecraft:hide_additional_tooltip Hides the special item's tooltip of crossbow ("Projectile:"), banner pattern layers, goat horn instrument and others. None.
15 minecraft:hide_tooltip Hides the item's tooltip altogether. None.
16 minecraft:repair_cost Accumulated anvil usage cost. The client displays "Too Expensive" if the value is greater than 40 and the player is not in creative mode (more specifically, if they don't have the insta-build flag enabled).
This behavior can be overridden by setting the level with the Set Container Property packet.
As follows:
Name Type Description
Cost VarInt
17 minecraft:creative_slot_lock Marks the item as non-interactive on the creative inventory (the first 5 rows of items).
This is used internally by the client on the paper icon in the saved hot-bars tab.
None.
18 minecraft:enchantment_glint_override Overrides the item glint resulted from enchantments As follows:
Name Type Description
Has Glint VarInt
19 minecraft:intangible_projectile Marks the projectile as intangible (cannot be picked-up). None.
20 minecraft:food Makes the item consumable. As follows:
Name Type Description
Nutrition VarInt Non-negative
Saturation Modifier Float How much saturation will be given after consuming the item.
Can Always Eat Boolean Whether the item can always be eaten, even at full hunger.
Seconds To Eat Float How long it takes to consume the item.
Using converts to Slot This specifies the item produced after consuming the current item. In the Notchian server, this is used for stews, which turn into bowls. Set this to Air if the item should be consumed normally without leaving any other item after.
Number of effects VarInt Number of elements in the following array.
Effect Type ID Array Potion Effect The potion effect. See Potion Effect.
Probability Float The probability for this effect to be chosen.
21 minecraft:fire_resistant Marks this item as fire resistant.
The client won't render the item as being on-fire if this component is present.
None.
22 minecraft:tool Alters the speed at which this item breaks certain blocks As follows:
Name Type Description
Number of Rules VarInt The number of elements in the following array.
Rule Blocks Array ID Set The blocks this rule applies to (IDs in the minecraft:block registry).
Has Speed Boolean
Speed Optional Float The speed at which the tool breaks this rules' blocks. Only present if Has Speed is true.
Has Correct Drop For Blocks Boolean
Correct Drop For Blocks Optional Boolean Whether items should drop only if this is the correct tool. Only present if Has Correct Drop For Blocks is true.
Default Mining Speed Float The mining speed in case none of the previous rule were matched.
Damage Per Block VarInt The amount of damage the item takes per block break.
23 minecraft:stored_enchantments The enchantments stored in this enchanted book. As follows:
Name Type Description
Number of enchantments VarInt Number of elements in the following array.
Enchantment Type ID Array VarInt Enum The ID of the enchantment in the enchantment registry.
Level VarInt The level of the enchantment.
Show In Tooltip Boolean Whether the list of enchantments should be shown on the item's tooltip.
24 minecraft:dyed_color Color of dyed leather armor. As follows:
Name Type Description
Color Int The RGB components of the color, encoded as an integer.
Show In Tooltip Boolean Whether the armor's color should be shown on the item's tooltip.
25 minecraft:map_color Color of the markings on the map item model. As follows:
Name Type Description
Color Int The RGB components of the color, encoded as an integer.
26 minecraft:map_id The ID of the map. As follows:
Name Type Description
ID VarInt
27 minecraft:map_decorations Icons present on a map. As follows:
Name Type Description
Data NBT Always a Compound Tag.
28 minecraft:map_post_processing Used internally by the client when expanding or locking a map. Display extra information on the item's tooltip when the component is present. As follows:
Name Type Description
Type VarInt Enum Type of post processing. Can be either:
  • 0 - Lock
  • 1 - Scale
29 minecraft:charged_projectiles Projectiles loaded into a charged crossbow. As follows:
Name Type Description
Number Of Projectiles VarInt The number of elements in the following array.
Projectiles Array of Slot The projectiles.
30 minecraft:bundle_contents Contents of a bundle. As follows:
Name Type Description
Number Of Items VarInt The number of elements in the following array.
Items Array of Slot The projectiles.
31 minecraft:potion_contents Visual and effects of a potion item. As follows:
Name Type Description
Has Potion ID Boolean Whether this potion has an ID in the potion registry. If true, it has the default effects associated with the potion type.
Potion ID Optional VarInt The ID of the potion type in the potion registry. Only present if Has Potion ID is true.
Has Custom Color Boolean Whether this potion has a custom color. If false, it uses the default color associated with the potion type.
Custom Color Optional Int The RGB components of the color, encoded as an integer. Only present if Has Custom Color is true.
Number Of Custom Effects VarInt The number of elements in the following array.
Custom Effects Array of Potion Effect Any custom effects the potion might have. See Potion Effect.
32 minecraft:suspicious_stew_effects Effects granted by a suspicious stew. As follows:
Name Type Description
Number Of Effects VarInt Number of elements in the following array.
Effect Type ID Array VarInt Enum The ID of the effect in the potion effect type registry.
Duration VarInt The duration of the effect.
33 minecraft:writable_book_content Content of a writable book. As follows:
Name Type Description
Number Of Pages VarInt Number of elements in the following array.
Page Raw Content Array (100) String (1024) The raw text of the page.
Has Filtered Content Boolean
Filtered Content Optional String (1024) The content after passing through chat filters. Only present if Has Filtered Content is true.
34 minecraft:written_book_content Content of a written and signed book. As follows:
Name Type Description
Raw Title String (32) The raw title of the book.
Has Filtered Title Boolean
Filtered Title Optional String (32) The title after going through chat filters. Only present if Has Filtered Title is true.
Author String
Generation VarInt
Number Of Pages VarInt Number of elements in the following array.
Page Raw Content Array (100) TextComponent (1024) The raw text of the page.
Has Filtered Content Boolean
Filtered Content Optional Text Component (1024) The content after passing through chat filters. Only present if Has Filtered Content is true.
Resolved Boolean Whether entity selectors have already been resolved.
35 minecraft:trim Armor's trim pattern and color As follows:
Name Type Description
Trim Material ID or Trim Material ID in the minecraft:trim_material registry, or an inline definition.
Trim Pattern ID or Trim Pattern ID in the minecraft:trim_pattern registry, or an inline definition.
Show In Tooltip Boolean Whether the trim information should be shown on the item's tooltip.
36 minecraft:debug_stick_state State of the debug stick As follows:
Name Type Description
Data NBT States of previously interacted blocks. Always a Compound Tag.
37 minecraft:entity_data Data for the entity to be created from this item. As follows:
Name Type Description
Data NBT Always a Compound Tag.
38 minecraft:bucket_entity_data Data of the entity contained in this bucket. As follows:
Name Type Description
Data NBT Always a Compound Tag.
39 minecraft:block_entity_data Data of the block entity to be created from this item. As follows:
Name Type Description
Data NBT Always a Compound Tag.
40 minecraft:instrument The sound played when using a goat horn. As follows:
Name Type Description
Instrument Id or Instrument ID in the minecraft:instrument registry, or an inline definition.
41 minecraft:ominous_bottle_amplifier Amplifier for the effect of an ominous bottle. As follows:
Name Type Description
Amplifier VarInt Between 0 and 4.
42 minecraft:jukebox_playable The song this item will play when inserted into a jukebox.

Warning.png The Notchian client assumes that the server will always represent the jukebox song either by name, or reference an entry on its respective registry. Trying to directly specify a jukebox song (when Jukebox Song Type is 0) will cause the client to fail to parse it and subsequently disconnect, which is likely an unintended bug.

As follows:
Name Type Description
Direct Mode Boolean Whether the jukebox song is specified directly, or just referenced by name.
Jukebox Song Name Optional Identifier The name of the jukebox song in its respective registry. Only present if Direct Mode is false.
Jukebox Song Optional ID or Jukebox Song ID in the minecraft:jukebox_song registry. Only present if Direct Mode is true.
Show In Tooltip Boolean Whether the song should be shown on the item's tooltip.
43 minecraft:recipes The recipes this knowledge book unlocks. As follows:
Name Type Description
Data NBT Always a Compound Tag.
44 minecraft:lodestone_tracker The lodestone this compass points to. As follows:
Name Type Description
Has Global Position Boolean Whether this lodestone points to a position, otherwise it spins randomly.
Dimension Identifier The dimension the compass points to. Only present if Has Global Position is true.
Position Position The position the compass points to. Only present if Has Global Position is true.
Tracked Boolean Whether the component is removed when the associated lodestone is broken.
45 minecraft:firework_explosion Properties of a firework star. As follows:
Name Type Description
Explosion Firework Explosion See Firework Explosion.
46 minecraft:fireworks Properties of a firework. As follows:
Name Type Description
Flight Duration VarInt
Number Of Explosions VarInt Number of elements in the following array.
Explosions Array of Firework Explosion See Firework Explosion.
47 minecraft:profile Game Profile of a player's head. As follows:
Name Type Description
Has Name Boolean
Name Optional String (16) Only present if Has Name is true.
Has Unique ID Boolean
Unique ID Optional UUID Only present if Has Unique ID is true.
Number of Properties VarInt Number of elements in the following array.
Property Name Array String (64)
Value String
Has Signature Boolean
Signature String (1024) Only present if Has Signature is true.
48 minecraft:note_block_sound Sound played by a note block when this player's head is placed on top of it. As follows:
Name Type Description
Sound Identifier
49 minecraft:banner_patterns Patterns of a banner or banner applied to a shield. As follows:
Name Type Description
Number of Layers VarInt Number of elements in the following array.
Layer Pattern Type Array VarInt Identifier used to determine the data that follows. It can be either:
  • 0 - Directly represents a pattern, with the necessary data following.
  • Anything else - References a pattern in its registry, by the ID of Pattern Type - 1.
Asset ID Optional Identifier Identifier of the asset. Only present if Pattern Type is 0.
Translation Key Optional String Only present if Pattern Type is 0.
Color Dye Color See Dye Color.
50 minecraft:base_color Base color of the banner applied to a shield. As follows:
Name Type Description
Color Dye Color See Dye Color.
51 minecraft:pot_decorations Decorations on the four sides of a pot. As follows:
Name Type Description
Number Of Decorations VarInt The number of elements in the following array.
Decorations Array (4) of VarInt Enum The ID of the items in the item registry.
52 minecraft:container Items inside a container of any type. As follows:
Name Type Description
Number Of Items VarInt The number of elements in the following array.
Items Array (256) of Slot
53 minecraft:block_state State of a block. As follows:
Name Type Description
Number of Properties VarInt Number of elements in the following array.
Property Name Array String
Value String
54 minecraft:bees Bees inside a hive. As follows:
Name Type Description
Number of Bees VarInt Number of elements in the following array.
Bee Entity Data Array NBT Custom data for the entity, always a Compound Tag. Same structure as the minecraft:custom_data component.
Ticks In Hive VarInt
Min Ticks In Hive VarInt
55 minecraft:lock Name of the necessary key to open this container. As follows:
Name Type Description
Key NBT Always a String Tag.
56 minecraft:container_loot Loot table for an unopened container. As follows:
Name Type Description
Data NBT Always a Compound Tag.

Other types

Common types used in multiple components are described below.

Block Predicate

Describes a predicate used when block filtering is necessary. It can be parameterized to account for the type of block, the values of specific block state properties, NBT data related to block entities, or any combination of the three.

Name Type Description
Has Blocks Boolean Whether this predicate is tied to specific types of blocks.
Blocks Optional ID Set IDs in the minecraft:block registry. Only present if Has Blocks is true.
Has Properties Boolean Whether this predicate is tied to specific properties of a block.
Number of Properties Optional VarInt Number of elements in the following array. Only present if Has Properties is true.
Properties Optional Array of Property See Property structure below. Only present if Has Properties is true.
Has NBT Boolean Whether this predicate is tied to specific block entity data.
NBT Optional NBT Only present is Has NBT is true.

The Property structure is defined as follows:

Name Type Description
Name String Name of the block state property.
Is Exact Match Boolean Whether this is an exact value match, as opposed to ranged.
Exact Value Optional String Value of the block state property. Only present in exact match mode.
Min Value Optional String Minimum value of the block state property range. Only present in ranged match mode.
Max Value Optional String Maximum value of the block state property range. Only present in ranged match mode.

Dye Color

A color from one of the 16 dye types.

Name Type Description
Color VarInt Enum Can be one of the following:
  • 0 - White
  • 1 - Orange
  • 2 - Magenta
  • 3 - Light Blue
  • 4 - Yellow
  • 5 - Lime
  • 6 - Pink
  • 7 - Gray
  • 8 - Light Gray
  • 9 - Cyan
  • 10 - Purple
  • 11 - Blue
  • 12 - Brown
  • 13 - Green
  • 14 - Red
  • 15 - Black

Firework Explosion

Represents a firework explosion, consisting of a shape, colors, and extra details.

Name Type Description
Shape VarInt Enum Can be one of the following:
  • 0 - Small ball
  • 1 - Large ball
  • 2 - Star
  • 3 - Creeper
  • 4 - Burst
Number Of Colors VarInt The number of elements in the following array.
Colors Array of Int The RGB components of the color, encoded as an integer.
Number Of Fade Colors VarInt The number of elements in the following array.
Fade Colors Array of Int The RGB components of the color, encoded as an integer.
Has Trail Boolean
Has Twinkle Boolean

Potion Effect

Describes all the aspects of a potion effect.

Name Type Description
Type ID VarInt Enum The ID of the effect in the potion effect type registry.
Details Detail See Detail structure below.

The Detail structure is defined as follows:

Name Type Description
Amplifier VarInt
Duration VarInt -1 for infinite.
Ambient Boolean Produces more translucent particle effects if true.
Show Particles Boolean Completely hides effect particles if false.
Show Icon Boolean Shows the potion icon in the inventory screen if true.
Has Hidden Effect Boolean Used to store the state of the previous potion effect when a stronger one is applied. This guarantees that the weaker one will persist, in case it lasts longer.
Huh.png The following information needs to be added to this page:
This behavior seems to be entirely server-sided. Does the presence of this field actually has any noticeable impact on the client?
Hidden Effect Optional Detail Only present if Has Hidden Effect is true.

Trim Material

See also: Registry_Data#Armor Trim Material
Name Type Description
Asset Name String
Ingredient VarInt
Item Model Index Float
Number of Overrides VarInt
Override Armor Material Type Array VarInt Enum
Overriden Asset Name String
Description Text Component

Trim Pattern

See also: Registry_Data#Armor Trim Pattern
Name Type Description
Asset Name String
Template Item VarInt
Description Text Component
Decal Boolean

Instrument

Name Type Description
Sound Event Id or Sound Event The sound to be played.
Use duration VarInt The maximum range of the sound.
Range Float The range of the instrument.

Jukebox Song

Name Type Description
Sound Event Optional Id or Sound Event The sound to be played.
Description Optional Text Component The description shown in the item lore.
Duration Optional Float The duration the songs should play for, in seconds.
Output Optional VarInt The output strength given by a comparator. Between 0 and 15.