Data component format

(Redirected from Data component)
This article is about the format in Java Edition. For the legacy format, see Item format/Before 1.20.5. For the format in Bedrock Edition, see Item components.
"Component" redirects here. For the text format, see Text component format.
This feature is exclusive to Java Edition.
 

Data components, or simply components, are structured data used to define and store various properties. They are used on items, where they are referred as item components or item stack components, and block entities, partially replacing NBT format.

Data components are used in various places, including the player's inventory, container block entities and structure files.

Data components are namespaced identifiers, and can be of different data types, listed here.

Usage Edit

Command format Edit

Data component can be used in the item_stack and item_predicate argument types.

In commands that take an item_stack argument, such as /give, items are represented in the format item_id[component1=value,component2=value], with component being the resource location of a component, and the value being the value of the component in SNBT format. Components can be removed by prefixing them with an exclamation mark, like item_id[!component3]. If no components are specified, the square brackets can be removed, leaving just the item ID. See item_stack for details.

In commands that take an item_predicate argument, such as /clear, items are represented in the format item_type[tests], with tests can be tests of data components or an item sub-predicate. See item_predicate for details.

Item format Edit

For the legacy format before 1.20.5, see Item format/Before 1.20.5.

Items are stored in the NBT format. Sometimes a [Byte] Slot tag is used to specify the slot the item is in, such as with chests; other times there is no [Byte] Slot tag, such as with dropped items.

Item types hold a set of default components on an item, that individual item stacks can override. Default components are not saved on individual item stacks.

  • [NBT Compound / JSON Object] The root tag.
    • [Byte] Slot: The inventory slot the item is in.
    • [String] id: The resource location of the item. Must not be air.
    • [Int] count: Number of items stacked in this inventory slot. Any item can be stacked, even if unstackable through normal means. Defaults to 1.
    • [NBT Compound / JSON Object] components: Optional map of data components. Additional information about the item.

Block entity format Edit

Main article: Block entity format

Block entities are stored in the NBT format. While they still use NBT for their specific properties, they keep the data components defined on the block item when placed.

  • [NBT Compound / JSON Object] The root tag.
    • [String] id: Block entity ID
    • [Boolean] keepPacked: 1 or 0 (true/false) - If true, this is an invalid block entity, and this block is not immediately placed when a loaded chunk is loaded. If false, this is a normal block entity that can be immediately placed.
    • [Int] x: X coordinate of the block entity.
    • [Int] y: Y coordinate of the block entity.
    • [Int] z: Z coordinate of the block entity.
    • [NBT Compound / JSON Object] components: Optional map of components.
    • Additional tags depending on the block entity ID. See Block entity format.

List of components Edit

attribute_modifiers Edit

Applies attribute modifiers onto items.

  • [NBT Compound / JSON Object] components: Parent tag.
    • [NBT List / JSON Array] minecraft:attribute_modifiers: Contains attribute modifiers on this item which modify attributes of the wearer or holder (if the item is not in the hand or armor slots, it has no effect).
      • [NBT Compound / JSON Object]: A single attribute modifier.
        • [String] type: The name of the attribute this modifier is to act upon.
        • [String] slot: Slot or slot type the item must be in for the modifier to take effect. Can be any, hand, armor, mainhand, offhand, head, chest, legs, feet or body. Defaults to any.
        • [String] id: The unique resource location to identify this modifier.
        • [Double] amount: Amount of change from the modifier.
        • [String] operation: Modifier operation. Can be add_value, add_multiplied_base or add_multiplied_total See Attribute Modifiers for info.

Example: /give @s stick[attribute_modifiers=[{type:"minecraft:scale",slot:"hand",id:"example:grow",amount:4,operation:"add_multiplied_base"}]]

  • Gives a stick that causes the player to grow 4x when holding it.

Edit

Applies banner patterns onto banners or shields.

  • [NBT Compound / JSON Object] components: Parent tag.
    • [NBT List / JSON Array] minecraft:banner_patterns: List of all patterns applied to the banner or the shield.
      • [NBT Compound / JSON Object]: A single pattern.

Example: /give @s black_banner[banner_patterns=[{pattern:"triangle_top",color:"red"},{pattern:"cross",color:"white"}]]

  • Gives a black banner with a red triangle and white cross pattern.

base_color Edit

Defines the base (dye) color of a banner applied to a shield.

  • [NBT Compound / JSON Object] components: Parent tag.
    • [String] minecraft:base_color: The base dye color of the banner applied on a shield.

Example: /give @s shield[base_color="lime"]

  • Gives a lime shield.

bees Edit

Specifies the amount of bees and their time in the hive. It's also possible to set their entity data.

  • [NBT Compound / JSON Object] components: Parent tag.
    • [NBT List / JSON Array] minecraft:bees: The entities currently in the beehive or bee nest.
      • [NBT Compound / JSON Object]: A single entity.
        • [NBT Compound / JSON Object] entity_data: The NBT data of the entity in the hive.
        • [Int] min_ticks_in_hive: The minimum amount of time in ticks for this entity to stay in the hive.
        • [Int] ticks_in_hive: The amount of ticks the entity has stayed in the hive.

Example: /give @s bee_nest[bees=[{entity_data:{id:"bee",CustomName:'"Maya"'},min_ticks_in_hive:60,ticks_in_hive:0}]]

  • Gives a bee nest containing a single bee named Maya, which exits the bee nest in 3 seconds.

block_entity_data Edit

Defines the block entity NBT data applied to the block after it's placed.

  • [NBT Compound / JSON Object] components: Parent tag.
    • [NBT Compound / JSON Object] minecraft:block_entity_data: Block entity NBT applied when this block is placed.

Example: /give @s spawner[block_entity_data={id:"mob_spawner",SpawnData:{entity:{id:"spider"}}}]

block_state Edit

Specifies block state properties applied to the block after it's placed.

  • [NBT Compound / JSON Object] components: Parent tag.
    • [NBT Compound / JSON Object] minecraft:block_state: The block state properties to apply when placing this block.
      • [String] <block state>: A key-value pair, where the key is a block state key and the value is a block state value to force place for this block, for example facing: "east".

Example: /give @s bamboo_slab[block_state={type:"top"}]

  • Gives a bamboo slab that is always placed in the top half of the block.

blocks_attacks Edit

Makes the item act like a shield, meaning it can block attacks when held.

  • [NBT Compound / JSON Object] components: Parent tag.
    • [NBT Compound / JSON Object] minecraft:blocks_attacks: When present, this item can be used like a shield to block attacks to the holding player.
      • [Float] block_delay_seconds: The amount of time (in seconds) that use must be held before successfully blocking attacks. Defaults to 0.
      • [Float] disable_cooldown_scale: The multiplier applied to the cooldown time for the item when attacked by a disabling attack (the multiplier for [Float] disable_blocking_for_seconds on the minecraft:weapon component). If set to 0, this item can never be disabled by attacks. Defaults to 1.
      • [NBT List / JSON Array] damage_reductions: Controls how much damage should be blocked in a given attack.
        • [NBT Compound / JSON Object]: A damage reduction field
          • [String][NBT List / JSON Array] type: Any number of damage type(s) (an [String] ID, or a [String] tag with #, or an [NBT List / JSON Array] array containing [String] IDs) to block. Defaults to all damage types.
          • [Float] base: The constant amount of damage to be blocked.
          • [Float] factor: The fraction of the dealt damage to be blocked.
          • [Float] horizontal_blocking_angle: strictly positive float — The maximum angle between the users facing direction and the direction of the incoming attack to be blocked. Defaults to 90
      • [NBT Compound / JSON Object] item_damage: Controls how much damage should be applied to the item from a given attack.
        • [Float] threshold: The minimum amount of damage dealt by the attack before item damage is applied to the item.
        • [Float] base: The constant amount of damage applied to the item, if threshold is passed.
        • [Float] factor: The fraction of the dealt damage that should be applied to the item, if threshold is passed.
      • [String][NBT Compound / JSON Object] block_sound: One sound event (an [String] ID, or a new [NBT Compound / JSON Object] sound event definition) to play when an attack is successfully blocked. Defaults to none.
      • [String][NBT Compound / JSON Object] disabled_sound: One sound event (an [String] ID, or a new [NBT Compound / JSON Object] sound event definition) to play when the item goes on its disabled cooldown due to an attack. Defaults to none.
      • [String] bypassed_by: a damage type tag with # of damage types that bypass the blocking. Defaults to none.


Example: /give @s diamond_sword[blocks_attacks={disable_cooldown_scale:0,damage_reductions:[{types:[mob_attack,arrow,explosion],base:0,factor:0.5}],block_sound:block.anvil.place}]

  • Gives a diamond sword that can block half of the damage from mob attacks, arrows, and explosions, cannot be disabled by a disabling attack, and plays the anvil place sound upon successful blocking.

break_sound Edit

Changes the sound that plays when the item breaks.

  • [NBT Compound / JSON Object] components: Parent tag.
    • [String][NBT Compound / JSON Object] minecraft:break_sound: One sound event (an [String] ID, or a new [NBT Compound / JSON Object] sound event definition) to play when the item runs out of durability and breaks.

Example: /give @s diamond_sword[break_sound="item.wolf_armor.break"]

  • Gives a diamond sword that when runs out of durability, it plays the wolf armor break sound.

bucket_entity_data Edit

Specifies the entity NBT applied to an entity when placed down from a bucket. Note that only some NBT tags are applied.

  • [NBT Compound / JSON Object] components: Parent tag.
    • [NBT Compound / JSON Object] minecraft:bucket_entity_data: NBT applied to an entity when placed from this bucket. Only tags below are applied.
      • [Boolean] NoAI: Turns into NoAI entity tag for all bucketable entities.
      • [Boolean] Silent: Turns into Silent entity tag for all bucketable entities.
      • [Boolean] NoGravity: Turns into NoGravity entity tag for all bucketable entities.
      • [Boolean] Glowing: Turns into Glowing entity tag for all bucketable entities.
      • [Boolean] Invulnerable: Turns into Invulnerable entity tag for all bucketable entities.
      • [Float] Health: Turns into Health entity tag for all bucketable entities.
      • [Int] Age: Turns into Age entity tag for axolotls and tadpoles.
      • [Int] Variant: Turns into Variant entity tag for axolotls.
      • [Long] HuntingCooldown: Turns into the expiry time of the memory module has_hunting_cooldown for axolotls.
      • [Int] BucketVariantTag: Turns into Variant entity tag for tropical fish.
      • [String] type: Turns into type entity tag for salmon.

Example: /give @s tropical_fish_bucket[bucket_entity_data={BucketVariantTag:117506305}]

  • Gives a bucket of tropical fish that always has the Anemone type.

bundle_contents Edit

Defines the items and their data stored inside a bundle.

  • [NBT Compound / JSON Object] components: Parent tag.

Example: /give @s bundle[bundle_contents=[{id:"diamond",count:2}]]

  • Gives a bundle containing exactly 2 diamonds.

can_break Edit

When present, the player holding the item can break the specified blocks in adventure mode.

  • [NBT Compound / JSON Object] components: Parent tag.
    • [NBT Compound / JSON Object][NBT List / JSON Array] minecraft:can_break: The only blocks this item may break when used by a player in adventure mode. If defined as a compound, corresponds to [NBT Compound / JSON Object] A single block predicate.
      • [NBT Compound / JSON Object]: A single block predicate.
        • [String][NBT List / JSON Array] blocks: Can be a block ID or a block tag with a #, or a list of block IDs.
        • [String] nbt: Block entity NBT to match. See Block entity format.
        • [NBT Compound / JSON Object] state: The block state properties to match.
          • [String] <block state>: A key-value pair, where the key is a block state key and the value is a block state value to match, for example facing: "east".

Example: /give @s netherite_pickaxe[can_break={blocks:['black_concrete','coal_ore','iron_ore','gold_ore','diamond_ore','emerald_ore']}]

  • Gives a netherite pickaxe that can only mine some ores, as well as black concrete.

can_place_on Edit

When present, the player holding the item can place the held block item on any sides of the specified blocks in adventure mode.

  • [NBT Compound / JSON Object] components: Parent tag.
    • [NBT Compound / JSON Object][NBT List / JSON Array] minecraft:can_place_on: Determines which blocks that blocks with this component can be placed against in adventure mode. If defined as a compound, corresponds to [NBT Compound / JSON Object] A single block predicate.
      • [NBT Compound / JSON Object]: A single block predicate.
        • [String][NBT List / JSON Array] blocks: Can be a block ID or a block tag with a #, or a list of block IDs.
        • [String] nbt: Block entity NBT to match. See Block entity format.
        • [NBT Compound / JSON Object] state: The block state properties to match.
          • [String] <block state>: A key-value pair, where the key is a block state key and the value is a block state value to match, for example facing: "east".

Example: /give @s target[can_place_on={blocks:'sandstone'}]

  • Gives a target block that can only be placed on sandstone.

charged_projectiles Edit

Defines the items and projectiles loaded into this crossbow. This component needs to be present for this crossbow to be charged.

  • [NBT Compound / JSON Object] components: Parent tag.
    • [NBT List / JSON Array] minecraft:charged_projectiles: The items loaded as projectiles into this crossbow. If not present, this crossbow is not charged.

Example: /give @s crossbow[charged_projectiles=[{id:"spectral_arrow"}]]

  • Gives a crossbow that is already charged with a spectral arrow.

Note: Adding an invalid projectile or item id charges an arrow that, when collected, grants the wrong item. Ex: wind_charge causes it to fire an arrow that grants a wind charge when collected.

consumable Edit

If present, the item can be consumed. Its options can also be modified.

  • [NBT Compound / JSON Object] components: Parent tag.
    • [NBT Compound / JSON Object] minecraft:consumable: If present, this item can be consumed on use.
      • [Float] consume_seconds: The amount of seconds it takes for a player to consume the item. Defaults to 1.6.
      • [String] animation: The animation used during consumption of the item. Must be one of none, eat, drink, block, bow, spear, crossbow, spyglass, toot_horn or brush. Defaults to eat.
      • [String][NBT Compound / JSON Object] sound: One sound event (an [String] ID, or a new [NBT Compound / JSON Object] sound event definition) used during and on completion of the item's consumption. Defaults to entity.generic.eat.
      • [Boolean] has_consume_particles: Whether consumption particles are emitted while consuming this item. Defaults to true.
      • [NBT List / JSON Array] on_consume_effects: A list of effects which take place as a result of consuming this item. Optional.

Example: /give @s gold_ingot[consumable={consume_seconds:3.0, animation:'eat', sound:'entity.generic.eat', has_consume_particles:true, on_consume_effects:[{type:'minecraft:clear_all_effects'}]}]

  • Gives a gold ingot that can be eaten in 3 seconds and upon consuming, clears all effects.

container Edit

Defines the items stored in a container item.

  • [NBT Compound / JSON Object] components: Parent tag.
    • [NBT List / JSON Array] minecraft:container: The items contained in this container.
      • [NBT Compound / JSON Object]: A single item.
        • [NBT Compound / JSON Object] item: The item stack in this slot.
        • [Int] slot: A slot in this container. Can be between 0 and 255 (inclusive).

Example: /give @s barrel[container=[{slot:0,item:{id:apple}}]]

  • Gives a barrel with an apple in the first slot.

container_loot Edit

Defines the loot table present in a container item.

  • [NBT Compound / JSON Object] components: Parent tag.
    • [NBT Compound / JSON Object] minecraft:container_loot: The unresolved loot table and seed of this container item.
      • [String] loot_table: The ID of a loot table.
      • [Long] seed: The pseudorandom seed to resolve the loot table with. If not specified or 0, a seed is randomly chosen by the game.

Example: /give @s chest[container_loot={loot_table:"chests/desert_pyramid"}]

  • Gives a chest that contains the desert pyramid loot when opened.

custom_data Edit

Store custom data on the item.

  • [NBT Compound / JSON Object] components: Parent tag.
    • [String][NBT Compound / JSON Object] minecraft:custom_data: Contains key-value pairs of any custom data not used by the game, either as an object or a SNBT string.
      • [Undefined] <key>: A key-value pair, where the value can have any data type, including another compound.

Example: /give @s iron_sword[custom_data={foo:1}]

  • Gives an iron sword with custom data {foo:1}.

custom_model_data Edit

Specifies the custom model data, which can be read by a resource pack's model by items model definition.

  • [NBT Compound / JSON Object] components: Parent tag.
    • [NBT Compound / JSON Object] minecraft:custom_model_data: A list of values used by items model definitions for model selection and coloring.
      • [NBT List / JSON Array] floats: A list of [Float] floats for the range_dispatch model type. Missing values return the fallback model.
      • [Byte Array] flags: A list of [Boolean] booleans for the condition model type. Missing value returns the is_false model.
      • [NBT List / JSON Array] strings: A list of [String] strings for the select model type. Missing value returns the fallback model.
      • [NBT List / JSON Array][Int Array] colors: A list of RGB values or number providers for the model model type's tints. Missing value returns the default value provided by the item model definition. Each entry can either be a list of floats or an integer. Any provided lists automatically convert to an integer, so the component is saved as an int array.
        • [Int]: A number representing a color codes in the hex code of the color converted to a decimal number. It can be calculated from the Red, Green and Blue components using this formula:
          Red<<16 + Green<<8 + Blue
        • [NBT List / JSON Array]: A list containing 3 floats corresponding to red, green and blue values as a fraction (ranged 0 to 1, inclusive) that is automatically converted to the int format.

Example:

/give @s bone[custom_model_data={floats:[4.0, 5.6, 99.1],strings:["foo:bar"]}]
  • Gives a bone with custom model data.

custom_name Edit

Used to specify the item's custom name, like you can in an anvil. This component:

  • has a higher priority over the item_name component
  • can be renamed or removed using an anvil
  • if unspecified otherwise, the item's name defaults to being italic.
  • [NBT Compound / JSON Object] components: Parent tag.
    • [String][NBT List / JSON Array][NBT Compound / JSON Object] minecraft:custom_name: Text component to use as this item's name. See Text component format.

Example:

/give @s stick[custom_name={text:"Magic Wand",color:"light_purple",italic:false}]
  • Gives a stick named "Magic Wand" in light purple non-italicized text.

damage Edit

Specifies the amount of durability lost (not remaining) from the item.

  • [NBT Compound / JSON Object] components: Parent tag.
    • [Int] minecraft:damage: The number of uses consumed (not remaining) of the item's durability. Must be a non-negative integer, defaults to 0.

Example: /give @s diamond_axe[damage=500]

  • Gives a diamond axe with 500 points of damage.

damage_resistant Edit

Items with this component, when thrown on the ground, are resistant to the damage types included in the component's damage tag.

This component also affects whether the equipped item is damaged when the wearer is hurt by the given damage type.

  • [NBT Compound / JSON Object] components: Parent tag.
    • [NBT Compound / JSON Object] minecraft:damage_resistant: If specified, this item is invulnerable to the specified damage types when in entity form or equipped.

debug_stick_state Edit

Used by the debug stick item to store the selected block state properties.

  • [NBT Compound / JSON Object] components: Parent tag.
    • [NBT Compound / JSON Object] minecraft:debug_stick_state: The selected block state properties used by this debug stick.
      • [String] <block ID>: A key-value pair, where the key is a block ID and the value is a block state key to edit on the block, for example "minecraft:oak_fence": "east".

Example: /give @s debug_stick[debug_stick_state={"minecraft:oak_fence": "west", "minecraft:candle": "lit"}]

  • Gives a debug stick with the oak fence block state property set to west and the candle block state property set to lit.

death_protection Edit

If present, this item acts like a totem of undying, by reviving the holder of this item.

  • [NBT Compound / JSON Object] components: Parent tag.
    • [NBT Compound / JSON Object] minecraft:death_protection: If present, this item protects the holder from dying by restoring a single health point.
      • [NBT List / JSON Array] death_effects: A list of consume effects that are applied when the item protects the holder. Optional.

Example: /give @s nether_star[death_protection={death_effects:[{type:'minecraft:clear_all_effects'}]}]

  • Gives a nether star that protects the holder from death and when did so, removes all status effects from the holder.

dyed_color Edit

Defines the color of this leather armor piece.

  • [NBT Compound / JSON Object] components: Parent tag.
    • [Int] minecraft:dyed_color: The color applied of this leather armor or wolf armor item. More generally, it is used as the minecraft:dye color provider in item model definitions. Color codes are the hex code of the color converted to a decimal number, or can be calculated from the red, green and blue components using this formula:
      Red<<16 + Green<<8 + Blue[note 1]
    • [NBT List / JSON Array] minecraft:dyed_color: Another format. A list containing 3 floats corresponding to red, green and blue values as a fraction (ranged 0 to 1, inclusive) that is automatically converted to the int format.

Example: /give @s leather_helmet[dyed_color=8388403]

or: /give @s leather_helmet[dyed_color=0x7FFF33]

or: /give @s leather_helmet[dyed_color=[0.5, 1.0, 0.2]]

  • Gives a blueish-green leather helmet.

enchantable Edit

Defines whether the item can be enchanted in an enchanting table. This only applies if there are applicable enchantments available for that item.

  • [NBT Compound / JSON Object] components: Parent tag.
    • [NBT Compound / JSON Object] minecraft:enchantable: If present, and applicable enchantments are available, items with the component can be enchanted in an enchanting table.
      • [Int] value: Positive integer representing the item's enchantability. A higher value allows enchantments with a higher cost to be picked.

Example: /give @s elytra[enchantable={value:15}]

  • Gives an elytra that can be enchanted in an enchanting table with an enchantability of 15.

enchantment_glint_override Edit

  • [NBT Compound / JSON Object] components: Parent tag.
    • [Boolean] minecraft:enchantment_glint_override: Overrides the enchantment glint effect on this item. When true, this item displays a glint, even without enchantments. When false, this item does not display a glint, even with enchantments.

Example: /give @s experience_bottle[enchantment_glint_override=false]

  • Gives an experience bottle without the visual enchantment glint, which is otherwise applied by default.

enchantments Edit

Specifies the enchantments on this item.

  • [NBT Compound / JSON Object] components: Parent tag.
    • [NBT Compound / JSON Object] minecraft:enchantments: Contains key-value pairs of levels of enchantments on this item that affect the way the item works.
      • [Int] <enchantment ID>: A single key-value pair, where the key is the resource location of an enchantment, and the value is the level.

Example: /give @s wooden_sword[enchantments={sharpness:3,knockback:2}]

  • Gives a wooden sword with sharpness III and knockback II.

Note: This component adds active enchantments and should not be confused with the minecraft:stored_enchantments component, which is used to add inactive enchantments, such as with enchanted books.

To illustrate the difference, hitting an entity with an enchanted_book[enchantments={knockback:2}] would knock any entity hit per knockback II while hitting an entity with an enchanted_book[stored_enchantments={knockback:2}] would not.

Furthermore the latter would be able to add knockback II to an enchantable item in an anvil, while the former would not.

entity_data Edit

Specifies the NBT data of an entity that is spawned/created from this item (e.g. armor stand, spawn egg, etc)

  • [NBT Compound / JSON Object] components: Parent tag.
    • [NBT Compound / JSON Object] minecraft:entity_data: NBT applied to an entity when created from an item.

Example: /give @s armor_stand[entity_data={id:"armor_stand",Small:1b}]

  • Gives an armor stand that is small when placed down.

equippable Edit

  • [NBT Compound / JSON Object] components: Parent tag.
    • [NBT Compound / JSON Object] minecraft:equippable: If present, this item can be equipped in the specified slot.
      • [String] slot: The slot to put the item on. Can be one of head, chest, legs, feet, body, mainhand, offhand or saddle
      • [String][NBT Compound / JSON Object] equip_sound: One sound event (an [String] ID, or a new [NBT Compound / JSON Object] sound event definition) to play when the item is equipped. Defaults to item.armor.equip_generic.
      • [String] asset_id: The resource location of the equipment model to use when equipped. The directory this refers to is assets/<namespace>/equipment/<id>.json. If not specified, falls back to rendering as the item itself when in the head slot (if not applicable, the item does not render).
      • [String][NBT List / JSON Array] allowed_entities: Entity ID, Entity Tag, or list of Entity IDs to limit which entities can equip this item. Defaults to all entities.
      • [Boolean] dispensable: Whether the item can be dispensed by using a dispenser.[note 2] Defaults to true.
      • [Boolean] swappable: Whether the item can be equipped into the relevant slot by right-clicking. Defaults to true.
      • [Boolean] damage_on_hurt: Whether this item is damaged when the wearing entity is damaged. Defaults to true.
      • [Boolean] equip_on_interact: Whether this item can be equipped onto a target mob by pressing use on it (as long as this item can be equipped on the target at all). Defaults to true.
      • [String] camera_overlay: The resource location of the overlay texture to use when equipped. The directory this refers to is assets/<namespace>/textures/<id>.

Example 1: /give @s glass[equippable={slot:"head",equip_sound:"block.glass.break",dispensable:true}]

  • Gives a glass block that can be equipped in the helmet slot.

Example 2: /give @s leather_leggings[equippable={slot:legs,asset_id:"minecraft:diamond"}]

  • Gives a pair of leather pants that appear as diamond leggings when worn.

firework_explosion Edit

The firework explosion effect stored inside of this firework star (not a firework rocket. For that see the fireworks component).

  • [NBT Compound / JSON Object] components: Parent tag.
    • [NBT Compound / JSON Object] minecraft:firework_explosion: The explosion effect stored by this firework star.
      • [String] shape: The shape of the explosion. Can be small_ball, large_ball, star, creeper or burst.
      • [NBT List / JSON Array] colors: The colors of the initial particles of the explosion, randomly selected from.
        • [Int] A color as a packed integer
      • [NBT List / JSON Array] fade_colors: The colors of the fading particles of the explosion, randomly selected from.
        • [Int] A color as a packed integer
      • [Boolean] has_trail: Whether or not the explosion has a trail effect (diamond).
      • [Boolean] has_twinkle: Whether or not the explosion has a twinkle effect (glowstone dust).

fireworks Edit

The firework explosion effects stored inside of this firework rocket (not a firework star, for that see the firework_explosion component).

  • [NBT Compound / JSON Object] components: Parent tag.
    • [NBT Compound / JSON Object] minecraft:fireworks
      • [NBT List / JSON Array] explosions: List of the explosion effects caused by this firework rocket. Has a maximum of 256 explosions.
        • [NBT Compound / JSON Object]: A single explosion effect.
          • [String] shape: The shape of the explosion. Can be small_ball, large_ball, star, creeper or burst.
          • [NBT List / JSON Array] colors: The colors of the initial particles of the explosion, randomly selected from.
            • [Int] A color as a packed integer
          • [NBT List / JSON Array] fade_colors: The colors of the fading particles of the explosion, randomly selected from.
            • [Int] A color as a packed integer
          • [Boolean] has_trail: Whether or not the explosion has a trail effect (diamond).
          • [Boolean] has_twinkle: Whether or not the explosion has a twinkle effect (glowstone dust).
      • [Byte] flight_duration: The flight duration of this firework rocket, i.e. the number of gunpowders used to craft it. Must be an integer between -128 and 127. Defaults to 1.

food Edit

  • [NBT Compound / JSON Object] components: Parent tag.
    • [NBT Compound / JSON Object] minecraft:food: The food stats for this consumable item. Has no effect unless the item can be consumed (i.e. the item has the consumable component).
      • [Int] nutrition: The number of food points restored by this item when eaten. Must be a non-negative integer.
      • [Float] saturation: The amount of saturation restored by this item when eaten.
      • [Boolean] can_always_eat: If true, this item can be eaten even if the player is not hungry. Defaults to false.

Example 1: /give @s melon_slice[food={nutrition:3,saturation:1,can_always_eat:true}]

  • Gives a melon slice that can be eaten at any time and restores 3 food points and 1 saturation.

Example 2: /give @s minecraft:sponge[consumable={consume_seconds:2.4},food={nutrition:5,saturation:5,can_always_eat:true}]

  • Gives a sponge that can be eaten at any time, takes 2.4 seconds to consume, and restores 5 food points and 5 saturation.

glider Edit

  • [NBT Compound / JSON Object] components: Parent tag.
    • [NBT Compound / JSON Object] minecraft:glider: If present, this item allows players to glide (as with elytra) when equipped.

Example: /give @s nether_star[equippable={slot:"head"},glider={}]

  • Gives a nether star that can be equipped in the head slot and if on the head, allows the player to glide.

instrument Edit

Specifies the instrument of a goat horn.

  • [NBT Compound / JSON Object] components: Parent tag.
    • [String][NBT Compound / JSON Object] minecraft:instrument: One instrument (an [String] ID, or a new [NBT Compound / JSON Object] instrument definition).
      • [String][NBT Compound / JSON Object] sound_event: One sound event (an [String] ID, or a new [NBT Compound / JSON Object] sound event definition).
      • [Float] use_duration: A non-negative float for how long the use duration is.
      • [Float] range: A non-negative float for the range of the sound.
      • [String][NBT List / JSON Array][NBT Compound / JSON Object] description: Text component to use as the instruments description. See Text component format.

Example: /give @s goat_horn[instrument="feel_goat_horn"]

intangible_projectile Edit

  • [NBT Compound / JSON Object] components: Parent tag.
    • [NBT Compound / JSON Object] minecraft:intangible_projectile: If set, this projectile item can't be picked up by a player when fired, except in creative mode. Can only be used within charged_projectiles components.

Example: /give @s arrow[intangible_projectile={}]

  • Gives an arrow that cannot be picked up by the player

item_model Edit

Defines the item model of this item.

  • [NBT Compound / JSON Object] components: Parent tag.
    • [String] minecraft:item_model: The resource location of the item, which references the item model definition /assets/<namespace>/items/<id> without the .json suffix.

Example: /give @s netherite_sword[item_model="minecraft:diamond_sword"]

  • Gives a netherite sword that looks like a diamond sword.

item_name Edit

  • [NBT Compound / JSON Object] components: Parent tag.
    • [String][NBT List / JSON Array][NBT Compound / JSON Object] minecraft:item_name: The default name of this item, as a text component. See Text component format. Unlike the custom_name component, this name cannot be erased using an anvil, is not italicized, and does not appear in some labels, such as banner markers and item frames.

jukebox_playable Edit

  • [NBT Compound / JSON Object] components: Parent tag.
    • [String] minecraft:jukebox_playable: One jukebox song (an [String] ID) to play when inserted into a jukebox. Presence of this component allows the item can be inserted into a jukebox to play the specified song.

Example:

/give @s diamond[minecraft:jukebox_playable="pigstep"]
  • Gives a diamond that plays Pigstep when inserted into a jukebox

lock Edit

Locks a container to a certain "key". The "key" must be an item with the same data as the container item's lock.

Example: /give @p chest[minecraft:lock={components:{"minecraft:item_model":"minecraft:diamond"}}]

  • Gives a chest that is locked, opening only if the player is holding an item with the same model as a Diamond.

Example: /give @p furnace[minecraft:lock={components:{"minecraft:custom_name":"'Furnace Key'"}}]

  • Gives a furnace that opens only if the player is holding an item with the custom name "Furnace Key".

Example: /give @p barrel[minecraft:lock={items:["minecraft:oak_planks","minecraft:diamond"],count:6,predicates:{custom_data:{bar:foo}}}]

  • Gives a barrel that opens only if the player is holding exactly 6 oak planks or 6 diamonds that has the custom data bar:foo

lodestone_tracker Edit

  • [NBT Compound / JSON Object] components: Parent tag.
    • [NBT Compound / JSON Object] minecraft:lodestone_tracker: If specified, stores information about the lodestone this compass should point toward.
      • [NBT Compound / JSON Object] target: Information about the lodestone. Optional. If not set, this compass spins randomly.
        • [Int Array] pos: The integer coordinates of the lodestone.
        • [String] dimension: The ID of the dimension of the lodestone.
      • [Boolean] tracked: If true, the component is removed when the lodestone is broken. If false, the component is kept. Defaults to true.

Example: /give @s compass[minecraft:lodestone_tracker={target:{pos:[I;1,2,3],dimension:"overworld"}}]

  • Gives a compass that points toward a lodestone that is located in the Overworld at x=1,y=2,z=3

lore Edit

Specifies the item's lore - that being the description of an item.

  • [NBT Compound / JSON Object] components: Parent tag.
    • [NBT List / JSON Array] minecraft:lore: List of additional lines to display in this item's tooltip. Has a maximum of 256 lines.
      • [String][NBT List / JSON Array][NBT Compound / JSON Object]: Text component representing a line of text. See Text component format.

Example:

/give @p stick[lore=[{text:"This Stick is very sticky."}]]
  • Gives a stick with lore in its tooltip.

Example:

/give @p diamond[lore=[{text:"A shiny Diamond!",italic:false,color:"gold"}]]
  • Gives a diamond that has lore in its tooltip. The color of the lore is gold, and its italics have been removed.

Example:

/give @p emerald[lore=[{text:"A shiny Emerald!","italic":false,"color":"gold"}, {text:"Maybe share it with a friend?",italic:false,color:"yellow"}]]
  • Gives an emerald that has 2 lines of lore in its tooltip. The first line has a golden color, and the second has a yellow color. Both lines have had their italics removed.

map_color Edit

Defines the color of the markings on the item of this map (not the actual map when viewed).

  • [NBT Compound / JSON Object] components: Parent tag.
    • [Int] minecraft:map_color: The color of the markings on this filled map item texture.

Example: /give @s filled_map[map_color=16711680]

  • Gives a filled map with red markings on item texture.

map_decorations Edit

Contains the icons that are displayed on this filled map (e.g. the structures on an explorer map).

  • [NBT Compound / JSON Object] components: Parent tag.
    • [NBT Compound / JSON Object] minecraft:map_decorations: Contains key-value pairs of the icons to display on this filled map.
      • [NBT Compound / JSON Object] <key>: The key-value pair of a single icon, where the key is an arbitrary unique string identifying the decoration.
        • [String] type: The type of the icon. Can be player, frame, red_marker, blue_marker, target_x, target_point, player_off_map, player_off_limits, mansion, monument, banner_white, banner_orange, banner_magenta, banner_light_blue, banner_yellow, banner_lime, banner_pink, banner_gray, banner_light_gray, banner_cyan, banner_purple, banner_blue, banner_brown, banner_green, banner_red, banner_black, red_x, village_desert, village_plains, village_savanna, village_snowy, village_taiga, jungle_temple or swamp_hut.
        • [Double] x: The X world coordinate of the decoration.
        • [Double] z: The Z world coordinate of the decoration.
        • [Float] rotation: The rotation of the icon, ranging from 0.0 to 360.0, rotated clockwise from north in degrees.

map_id Edit

The id of the map to show. Maps are stored in .minecraft\saves\<world_name>\data and have file names such as map_1.dat.[verify]

  • [NBT Compound / JSON Object] components: Parent tag.
    • [Int] minecraft:map_id: The number of this filled map, representing the shared state holding map contents and markers.

max_damage Edit

  • [NBT Compound / JSON Object] components: Parent tag.
    • [Int] minecraft:max_damage: The maximum amount of damage that this item can take. If not set, this item cannot take damage. Must be a positive integer. Cannot be combined with max_stack_size if it has a value greater than 1 (if the item can be stacked). For the durability bar to apear, the damage component must have a value. Example "damage=0"

Example: /give @s diamond_pickaxe[max_damage=4]

  • Gives a diamond pickaxe that can only be used 4 times before breaking.

max_stack_size Edit

  • [NBT Compound / JSON Object] components: Parent tag.
    • [Int] minecraft:max_stack_size: The maximum number of items that can fit in a stack. Must be a positive integer between 1 and 99 (inclusive). If it has a value greater than 1 (if the item can be stacked), cannot be combined with max_damage.

Example: /give @s acacia_boat[max_stack_size=64] 5

  • Gives a stack of 5 acacia boats all in a single slot.

note_block_sound Edit

  • [NBT Compound / JSON Object] components: Parent tag.
    • [String] minecraft:note_block_sound: The ID of the sound event played by a note block when this player head is placed above.

Example: /give @p minecraft:player_head[minecraft:profile=minecraftWiki,minecraft:note_block_sound=entity.item.pickup]

  • Gives a Player Head of the minecraftWiki. If placed on a Note Block, the Note Block plays the "Item Pickup" sound every time it's activated.

ominous_bottle_amplifier Edit

  • [NBT Compound / JSON Object] components: Parent tag.
    • [Int] minecraft:ominous_bottle_amplifier: The amplifier amount of the Bad Omen effect on this ominous bottle. Must be a positive integer between 0 and 4 (inclusive).

pot_decorations Edit

Defines the sherds applied on a decorated pot.

  • [NBT Compound / JSON Object] components: Parent tag.
    • [NBT List / JSON Array] minecraft:pot_decorations: A list of the sherds applied on each face of this decorated pot. If the list has less than 4 entries, the remaining ones default to "minecraft:brick".
      • [String]: The ID of an item. Can be either brick or a sherd.

Example: /give @s decorated_pot[pot_decorations=["skull_pottery_sherd","heart_pottery_sherd","blade_pottery_sherd","brick"]]

  • Gives a decorated pot with sherds: skull, heart and blade on its faces

potion_contents Edit

  • [NBT Compound / JSON Object] components: Parent tag.
    • [String][NBT Compound / JSON Object] minecraft:potion_contents: The potion and custom effects contained in this potion, splash potion, lingering potion, or tipped arrow. If defined as a string, corresponds to [String] potion.
      • [String] potion: The ID of a potion type. Optional. See Potion#Item data.
      • [Int] custom_color: The overriding color of this potion texture, and/or the particles of the area effect cloud created.
      • [String] custom_name: An optional string used to generate containing stack name. The game uses the translation key item.minecraft.<item type>.effect.<value>. This name has a higher priority than the minecraft:item_name component, but lower than the minecraft:custom_name component.
      • [NBT List / JSON Array] custom_effects: A list of the additional effects that this item should apply.
        • [NBT Compound / JSON Object]: A single custom effect.
          • [String] id: The ID of the effect.
          • [Byte] amplifier: The amplifier of the effect, with level I having value 0. Optional, defaults to 0.
          • [Int] duration: The duration of the effect in ticks. Value -1 is treated as infinity. Values 0 or less than -2 are treated as 1. Optional, defaults to 1 tick.
          • [Boolean] ambient: Whether or not this is an effect provided by a beacon and therefore should be less intrusive on the screen. Optional, defaults to false.
          • [Boolean] show_particles: Whether or not this effect produces particles. Optional, defaults to true.
          • [Boolean] show_icon: Whether or not an icon should be shown for this effect. Optional, defaults to true.

potion_duration_scale Edit

  • [NBT Compound / JSON Object] components: Parent tag.
    • [Float] minecraft:potion_duration_scale: When present, for items that have the minecraft:potion_contents component, the duration of the applied effects is scaled by this factor. Defaults to 1.0.

Example: /give @p potion[potion_contents={potion:swiftness},potion_duration_scale=2]

  • Gives a Potion of Swiftness that has its default time doubled from 3 Minutes to 6 Minutes.

profile Edit

  • [NBT Compound / JSON Object] components: Parent tag.
    • [String][NBT Compound / JSON Object] minecraft:profile: Information about the owner of this player head. If defined as a string, corresponds to [String] name.
      • [String] name: The name of a player profile, i.e. its username. If this is the only tag provided, it resolves into the other ones below. Optional.
      • [Int Array] id: The UUID of the owner. Used to update the other tags when the chunk loads or the holder logs in, in case the owner's name has changed. Optional.
      • [NBT List / JSON Array] properties: A list of properties. Optional.
        • [NBT Compound / JSON Object]: A single property.
          • [String] name: The name of the property. Can be textures.
          • [String] value: The texture data json, encoded in base64.
          • [String] signature: Optional. Mojang's signature of the value, encoded in base64.

Example: /give @p player_head[profile=MinecraftWiki]

  • Gives a player head of MinecraftWiki.

provides_banner_patterns Edit

  • [NBT Compound / JSON Object] components: Parent tag.
    • [String] minecraft:provides_banner_patterns: When present, this item can be placed in the pattern slot of a loom and provides the specified banner pattern tag. Must be a tag prefixed with #.

Example: /give @p diamond[provides_banner_patterns='#minecraft:pattern_item/globe']

  • Gives a diamond that can provide the globe banner pattern to a banner.

provides_trim_material Edit

  • [NBT Compound / JSON Object] components: Parent tag.
    • [String] minecraft:provides_trim_material: When present, this item provides the specified trim material when used in a trimming recipe.[note 3]

rarity Edit

Defines the rarity of the item. Setting a rarity changes the color of its default name. common is white, uncommon is yellow, rare is aqua and epic is light purple.

  • [NBT Compound / JSON Object] components: Parent tag.
    • [String] minecraft:rarity: Sets the rarity of this item, which affects the default color of its name. Can be common, uncommon, rare or epic.

Example: /give @p iron_sword[rarity=epic]

  • Gives an iron sword with a light purple name.

recipes Edit

  • [NBT Compound / JSON Object] components: Parent tag.
    • [NBT List / JSON Array] minecraft:recipes: The recipes that a player unlocks when this knowledge book is used.

Example: /give @p knowledge_book[recipes=["minecraft:end_crystal","minecraft:diamond","minecraft:stone_sword","minecraft:blast_furnace"]]

  • Gives a knowledge book that, when used, gives the player the recipes listed inside the component.

repairable Edit

  • [NBT Compound / JSON Object] components: Parent tag.
    • [NBT Compound / JSON Object] minecraft:repairable: Allows the item to be repaired, if damageable, in an anvil using the specified ingredient.
      • [String][NBT List / JSON Array] items: Item, list of Items, or hash-prefixed Item Tag matching what can be used to repair this item.

Example: /give @p diamond_sword[repairable={items:"stick"}]

  • Gives a diamond sword that can be repaired with sticks in an anvil.

repair_cost Edit

  • [NBT Compound / JSON Object] components: Parent tag.
    • [Int] minecraft:repair_cost: The number of experience levels to add to the base level cost when repairing, combining, or renaming this item with an anvil. Must be a non-negative integer, defaults to 0.

stored_enchantments Edit

Defines the stored enchantments on this item.

  • [NBT Compound / JSON Object] components: Parent tag.
    • [NBT Compound / JSON Object] minecraft:stored_enchantments: Contains key-value pairs of levels of enchantments stored on this enchanted book.
      • [Int] <enchantment ID>: A single key-value pair, where the key is the resource location of an enchantment, and the value is the level.

suspicious_stew_effects Edit

  • [NBT Compound / JSON Object] components: Parent tag.
    • [NBT List / JSON Array] minecraft:suspicious_stew_effects: The effects applied when consuming this suspicious stew.
      • [NBT Compound / JSON Object]: A single custom effect.
        • [String] id: The ID of the effect.
        • [Int] duration: The duration of the effect in ticks. Defaults to 160.

tool Edit

  • [NBT Compound / JSON Object] components: Parent tag.
    • [NBT Compound / JSON Object] minecraft:tool: If set, this item is considered as a tool.
      • [Float] default_mining_speed: The default mining speed of this tool, used if no rules override it. Defaults to 1.0.
      • [Int] damage_per_block: The amount of durability to remove each time a block is broken with this tool. Must be a non-negative integer. Defaults to 1.
      • [Boolean] can_destroy_blocks_in_creative: Whether players can break blocks while holding this tool in Creative mode. Defaults to true.
      • [NBT List / JSON Array] rules: A list of rules for the blocks that this tool has a special behavior with. If a field is overridden by multiple matched rules, the one that comes first in the list is chosen.
        • [NBT Compound / JSON Object]: A single rule.
          • [String][NBT List / JSON Array] blocks: The blocks to match with. Can be a block ID or a block tag with a #, or a list of block IDs.
          • [Float] speed: If the blocks match, overrides the default mining speed. Optional.
          • [Boolean] correct_for_drops: If the blocks match, overrides whether or not this tool is considered correct to mine at its most efficient speed, and to drop items if the block's loot table requires it. If not set by any rules, defaults to false. Optional.

Example: /give @p oak_fence[max_stack_size=1,max_damage=350,damage=0,tool={default_mining_speed:1.5,damage_per_block:2,rules:[{blocks:"#mineable/pickaxe",speed:6,correct_for_drops:true}]}]

  • Gives an oak fence that has the properties of a pickaxe.

tooltip_display Edit

Hides any tooltips provided by the specified components on this item.

  • [NBT Compound / JSON Object] components: Parent tag.
    • [NBT Compound / JSON Object] minecraft:tooltip_display: Allows the tooltips provided specifically by any given item component to be surpressed.
      • [Boolean] hide_tooltip: If true, the item has no tooltip when hovered.
      • [NBT List / JSON Array] hidden_components: The tooltips provided by any component in this list are hidden. If that component provides no tooltip, it has no effect.

Example 1: /give @p diamond_sword[tooltip_display={hidden_components:["minecraft:enchantments"]},enchantments={sharpness:1}]

  • Gives a diamond sword that is enchanted with Sharpness I, but doesn't show the enchantments in the tooltip.

Example 2: /give @p diamond_sword[tooltip_display={hide_tooltip:1b}]

  • Gives a diamond sword that when hovered, it shows no tooltip at all.

tooltip_style Edit

Changes the item's tooltip style by specifying the direct path to a custom tooltip texture in a resource pack.

  • [NBT Compound / JSON Object] components: Parent tag.
    • [String] minecraft:tooltip_style: The resource location of the custom sprites for the tooltip background and frame which references textures /assets/<namespace>/textures/gui/sprites/tooltip/<id>_background and /assets/<namespace>/textures/gui/sprites/tooltip/<id>_frame.

trim Edit

Stores the trims applied on this piece of armor.

  • [NBT Compound / JSON Object] components: Parent tag.
    • [NBT Compound / JSON Object] minecraft:trim: Contains the trim applied to this armor piece.
      • [String] pattern: The ID of the trim pattern.
      • [String] material: The ID of the trim material, which applies a color to the trim.

Example: /give @p minecraft:leather_leggings[trim={"pattern":"host","material":"emerald"}] 1

unbreakable Edit

  • [NBT Compound / JSON Object] components: Parent tag.
    • [NBT Compound / JSON Object] minecraft:unbreakable: If set, this item doesn't lose durability when used.

use_cooldown Edit

  • [NBT Compound / JSON Object] components: Parent tag.
    • [NBT Compound / JSON Object] minecraft:use_cooldown: If present, this item applies a cooldown to all items of the same type when it has been used.
      • [Float] seconds: The cooldown duration in seconds.
      • [String] cooldown_group: The unique resource location to identify this cooldown group. If present, the item is included in a cooldown group and no longer shares cooldowns with its base item type, but instead with any other items that are part of the same cooldown group. Optional.

Example: /give @p ender_pearl[use_cooldown={seconds:10,cooldown_group:"foo:bar"}]

  • Gives an ender pearl that has a 10 second cooldown after being used, and also applies that cooldown to any item that shares its cooldown_group.
    • If other items in the inventory share the same cooldown_group, but have different seconds, then using that item applies the seconds of itself to all other items in the inventory, rather than each item applying their own seconds to themselves.
  • Items can have their cooldowns disabled completely by removing the component with [!use_cooldown].

use_remainder Edit

  • [NBT Compound / JSON Object] components: Parent tag.
    • [NBT Compound / JSON Object] minecraft:use_remainder: If present, replaces the item with a remainder item if its stack count has decreased after use.

Example: /give @p splash_potion[use_remainder={id:"minecraft:gunpowder"}]

  • Gives a splash potion, which after being thrown, leaves gunpowder.

Example: /give @p cooked_chicken[use_remainder={id:"minecraft:bone",components:{custom_name:{text:"Chicken Bone"}},count:2}]

  • Gives a cooked chicken, which after being used, turns into 2 bones named "Chicken Bone".

weapon Edit

If present, the item acts as a weapon. For attack damage see the attribute_modifiers component.

  • [NBT Compound / JSON Object] components: Parent tag.
    • [NBT Compound / JSON Object] minecraft:weapon: When present, the specified amount of damage can be done to the item with each attack. Additionally, the 'Item Used' statistic is incremented for each attack with the item.
      • [Int] item_damage_per_attack: The amount to damage the item for each attack performed. Defaults to 1.
      • [Float] disable_blocking_for_seconds: The amount of seconds that this item can disable a blocking shield on successful attack. If set to 0, this item cannot disable a blocking shield. Defaults to 0.

Example: /give @p minecraft:stick[weapon={},max_damage=10]

  • Gives a Stick that has 10 durability, and loses 1 durability for each attack performed.

Example: /give @p iron_sword[minecraft:weapon={disable_blocking_for_seconds:5,item_damage_per_attack:10}]

  • Gives an Iron Sword that disables Shields when used on them for 5 seconds, but loses 10 durability for each attack performed.

writable_book_content Edit

Defines the content written in this book and quill.

  • [NBT Compound / JSON Object] components: Parent tag.
    • [NBT Compound / JSON Object] minecraft:writable_book_content: The contents of this book and quill.
      • [NBT List / JSON Array] pages: A list of the pages in the book.
        • [NBT Compound / JSON Object]: A single page.
          • [String] raw: The plain text content of the page.
          • [String] filtered: The filtered text of the page. Optional. Shown only to players with chat filter enabled, instead of [String] text.
          Alternatively, a single page can be represented as follows:
        • [String]: The plain text content of a page.

written_book_content Edit

Defines the content and metadata in this written book.

  • [NBT Compound / JSON Object] components: Parent tag.
    • [NBT Compound / JSON Object] minecraft:written_book_content: The contents and metadata of this written book.
      • [NBT List / JSON Array] pages: A list of the pages in the book.
        • [NBT Compound / JSON Object]: A single page.
          • [String][NBT List / JSON Array][NBT Compound / JSON Object] raw: The text component representing the text content of the page. See Text component format.
          • [String][NBT List / JSON Array][NBT Compound / JSON Object] filtered: The Text component representing the filtered text of the page. Optional. Shown only to players with chat filter enabled, instead of [String] text.
          Alternatively, a single page can be represented as follows:
        • [String][NBT List / JSON Array][NBT Compound / JSON Object]: The text component representing the text content of the page.
      • [NBT Compound / JSON Object] title: The title of this written book.
        • [String] raw: The plain text title.
        • [String] filtered: The filtered title. Optional. Shown only to players with chat filter enabled, instead of [String] text.
      • [String] author: The author of this written book.
      • [Int] generation: The number of times this written book has been copied. 0 = original, 1 = copy of original, 2 = copy of copy, 3 = tattered. Defaults to 0. If the value is greater than 1, the book cannot be copied.
      • [Boolean] resolved: If true, the text components have already been resolved (such as entity selectors and scores). If false, they are resolved when this book is opened by a player for the first time. Defaults to false.

Entity variant components Edit

This section is a work in progress.
 
Please help expand and improve it. The talk page may contain suggestions.
Note: Add more information about entity variant components (in general)

Entity variant components are a group of components that are present in items like spawn eggs, mob buckets, paintings, item frames, etc. These components modify some of the properties of the entity stored within those items.

Here is a list of all entity variant components:

axolotl/variant Edit

  • [NBT Compound / JSON Object] components: Parent tag.
    • [String] minecraft:axolotl/variant: lucy, wild, gold, cyan, or blue — The variant of the axolotl

Example: /give @s axolotl_spawn_egg[axolotl/variant="blue"]

  • Gives a axolotl spawn egg that spawns a blue axolotl.

cat/collar Edit

  • [NBT Compound / JSON Object] components: Parent tag.
    • [String] minecraft:cat/collar: A dye color — The color of the collar of the cat

Example: /give @s cat_spawn_egg[cat/collar="blue"]

  • Gives a cat spawn egg that spawns a cat with a blue collar (once tamed).

cat/variant Edit

  • [NBT Compound / JSON Object] components: Parent tag.
    • [String] minecraft:cat/variant: One cat variant (an [String] ID) — The variant of the cat

Example: /give @s cat_spawn_egg[cat/variant="jellie"]

  • Gives a cat spawn egg that spawns a Jellie (gray and white) cat.

chicken/variant Edit

  • [NBT Compound / JSON Object] components: Parent tag.
    • [String] minecraft:chicken/variant: One chicken variant (an [String] ID) — The variant of the chicken

Example 1: /give @s chicken_spawn_egg[chicken/variant="cold"]

  • Gives a chicken spawn egg that spawns a cold chicken.

Example 2: /give @s egg[chicken/variant="cold"]

  • Gives an egg that has a chance to hatch a cold chicken.

cow/variant Edit

  • [NBT Compound / JSON Object] components: Parent tag.
    • [String] minecraft:cow/variant: One cow variant (an [String] ID) — The variant of the cow

Example: /give @s cow_spawn_egg[cow/variant="cold"]

  • Gives a cow spawn egg that spawns a cold cow.

fox/variant Edit

  • [NBT Compound / JSON Object] components: Parent tag.
    • [String] minecraft:fox/variant: red or snow — The variant of the fox

Example: /give @s fox_spawn_egg[fox/variant="snow"]

  • Gives a fox spawn egg that spawns a snow fox.

frog/variant Edit

  • [NBT Compound / JSON Object] components: Parent tag.
    • [String] minecraft:frog/variant: One frog variant (an [String] ID) — The variant of the frog

Example: /give @s frog_spawn_egg[frog/variant="cold"]

  • Gives a frog spawn egg that spawns a cold frog.

horse/variant Edit

  • [NBT Compound / JSON Object] components: Parent tag.
    • [String] minecraft:horse/variant: white, creamy, chestnut, brown, black, gray, or dark_brown — The variant of the horse

Example: /give @s horse_spawn_egg[horse/variant="chestnut"]

  • Gives a horse spawn egg that spawns a chestnut horse.

llama/variant Edit

  • [NBT Compound / JSON Object] components: Parent tag.
    • [String] minecraft:llama/variant: creamy, white, brown, or gray — The variant of the llama

Example: /give @s llama_spawn_egg[llama/variant="gray"]

  • Gives a llama spawn egg that spawns a gray llama.

mooshroom/variant Edit

  • [NBT Compound / JSON Object] components: Parent tag.
    • [String] minecraft:mooshroom/variant: red or brown — The variant of the mooshroom

Example: /give @s mooshroom_spawn_egg[mooshroom/variant="brown"]

  • Gives a mooshroom spawn egg that spawns a brown mooshroom.

painting/variant Edit

Example: /give @s painting[painting/variant="plant"]

  • Gives a painting that places the "Paradisträd" painting.

parrot/variant Edit

  • [NBT Compound / JSON Object] components: Parent tag.
    • [String] minecraft:parrot/variant: red_blue, blue, green, yellow_blue, or gray — The variant of the parrot

Example: /give @s parrot_spawn_egg[parrot/variant="blue"]

  • Gives a parrot spawn egg that spawns a blue parrot.

pig/variant Edit

  • [NBT Compound / JSON Object] components: Parent tag.
    • [String] minecraft:pig/variant: One pig variant (an [String] ID) — The variant of the pig

Example: /give @s pig_spawn_egg[pig/variant="warm"]

  • Gives a pig spawn egg that spawns a warm pig.

rabbit/variant Edit

  • [NBT Compound / JSON Object] components: Parent tag.
    • [String] minecraft:rabbit/variant: brown, white, black, white_splotched, gold, salt, or evil — The variant of the rabbit

Example: /give @s rabbit_spawn_egg[rabbit/variant="evil"]

  • Gives a rabbit spawn egg that spawns an evil rabbit.

salmon/size Edit

  • [NBT Compound / JSON Object] components: Parent tag.
    • [String] minecraft:salmon/size: small, medium, large — The size of the salmon

Example: /give @s salmon_spawn_egg[salmon/size="large"]

  • Gives a salmon spawn egg that spawns a large salmon.

sheep/color Edit

  • [NBT Compound / JSON Object] components: Parent tag.
    • [String] minecraft:sheep/color: A dye color — The color of the wool of the sheep

Example: /give @s sheep_spawn_egg[sheep/color="blue"]

  • Gives a sheep spawn egg that spawns a sheep with blue wool.

shulker/color Edit

  • [NBT Compound / JSON Object] components: Parent tag.

Example: /give @s shulker_spawn_egg[shulker/color="red"]

  • Gives a shulker spawn egg that spawns a red shulker.

tropical_fish/base_color Edit

  • [NBT Compound / JSON Object] components: Parent tag.

tropical_fish/pattern Edit

  • [NBT Compound / JSON Object] components: Parent tag.
    • [String] minecraft:tropical_fish/pattern: kob, sunstreak, snooper, dasher, brinely, spotty, flopper, stripey, glitter, blockfish, betty, or clayfish — The pattern of the tropical fish

tropical_fish/pattern_color Edit

  • [NBT Compound / JSON Object] components: Parent tag.

Example: /give @s tropical_fish_spawn_egg[tropical_fish/pattern="snooper", tropical_fish/base_color="red", tropical_fish/pattern_color="blue"]

  • Gives a tropical fish spawn egg that spawns a red-blue snooper tropical fish.

villager/variant Edit

  • [NBT Compound / JSON Object] components: Parent tag.
    • [String] minecraft:villager/variant: desert, jungle, plains, savanna, snow, swamp, or taiga — The variant of the villager

Example: /give @s villager_spawn_egg[villager/variant="desert"]

  • Gives a villager spawn egg that spawns a desert villager.

wolf/collar Edit

  • [NBT Compound / JSON Object] components: Parent tag.
    • [String] minecraft:wolf/collar: A dye color — The color of the collar of the wolf

Example: /give @s wolf_spawn_egg[wolf/collar="blue"]

  • Gives a wolf spawn egg that spawns a wolf with a blue collar (when tamed).

wolf/sound_variant Edit

  • [NBT Compound / JSON Object] components: Parent tag.
    • [String] minecraft:wolf/sound_variant: wolf sound variant definition — The sound variant of the wolf

Example: /give @s wolf_spawn_egg[wolf/sound_variant="cute"]

  • Gives a wolf spawn egg that spawns a cute wolf.

wolf/variant Edit

  • [NBT Compound / JSON Object] components: Parent tag.
    • [String] minecraft:wolf/variant: One wolf variant (an [String] ID) — The variant of the wolf

Example: /give @s wolf_spawn_egg[wolf/variant="rusty"]

  • Gives a wolf spawn egg that spawns a rusty wolf.

Non-encoded components Edit

Two other data components exist and are used by the game internally, but are not encoded on items. Therefore, they cannot be used in commands, nor seen with /data.

creative_slot_lock Edit

  • [NBT Compound / JSON Object] components: Parent tag.
    • [NBT Compound / JSON Object] minecraft:creative_slot_lock: Only used internally to lock the informational paper items in the creative inventory. If set, this item cannot be taken out of its slot.

map_post_processing Edit

  • [NBT Compound / JSON Object] components: Parent tag.
    • [Int] minecraft:map_post_processing: Only used internally when this filled map has been duplicated or locked in a crafting table or a cartography table. Can be 0 (lock) or 1 (scale), adding the "Locked" line or "Scale" line in this item's tooltip, respectively.

Temporary components Edit

The following components were added and used in the April Fools' Day joke snapshot 24w14potato in 2024.

History Edit

[hide]Java Edition
1.20.524w09aReplaced [NBT Compound / JSON Object] tag tag and all underlying item-specific tags with data components.
Replaced [Byte] Count with [Int] count.
24w10aRenamed lodestone_target component to lodestone_tracker, and moved [Int Array] pos and [String] dimension fields to [NBT Compound / JSON Object] target.
profile, dyed_color, attribute_modifiers, potion_contents, enchantments, and stored_enchantments components can now optionally be defined in simpler formats.
lore and fireworks components now allow up to 256 entries in their list.
container component now applies to all containers, instead of only shulker boxes.
[String] name is no longer required in profile component.
24w12aAdded food, max_stack_size, max_damage, fire_resistant, rarity, tool, and hide_tooltip components.
The old {...} item format has been removed, and can no longer be used as a shortcut for custom_data component.
24w13aAdded item_name, and ominous_bottle_amplifier components.
Components with non-default values on block items are now stored on block entities when placed.
24w14aRenamed [String] text to [String] raw in writable_book_content, and written_book_content components.
Pre-Release 1Renamed [Float] saturation_modifier to [Float] saturation in food component.
max_damage, and max_stack_size components can no longer be put together.
1.2124w19acustom_data component can now be defined as a SNBT string.
Added [NBT Compound / JSON Object] using_converts_to in food component.
24w21aAdded jukebox_playable component.
Changed attribute_modifiers component: removed [String] name and [Int Array] uuid fields, added [String] id field.
1.21.224w33aAdded repairable and enchantable components.
The title specified in the written_book_content component is now prioritized over custom_name and item_name for any item with a non-empty title in this component.
24w34aAdded consumable, use_cooldown and use_remainder components.
The food component has been changed to become a data container that holds only the food stats applied when the item is consumed. The component no longer gives the item the ability to be consumed. Removed the [Float] eat_seconds, [NBT Compound / JSON Object] using_converts_to and [NBT List / JSON Array] effects fields from food.
24w36aAdded equippable, item_model, glider and tooltip_style components.
The item_name component is now always present on every item.
24w37aAdded death_protection component.
Renamed fire_resistant component to damage_resistant, and added [String] types field.
The name provided by the item_name component now always has the lowest priority.
Added [String] custom_name in potion_contents component.
Added [Boolean] swappable and [Boolean] damage_on_hurt in equippable component.
Pre-Release 1Added [String] camera_overlay in equippable component.
1.21.424w45acustom_model_data now has more fields to accomodate new uses by various model property getters: floats, flags, strings and colors.
item_model now uses assets/[namespace]/items/, rather than assets/[namespace]/models/item.
1.21.525w02aAdded weapon and potion_duration_scale components.
Added new optional field [Boolean] can_destroy_blocks_in_creative to tool component.
25w03a[Int] damage_per_attack field in weapon component was renamed to [Int] item_damage_per_attack
equippable component can now apply to saddle slot, and has a new optional field: [Boolean] equip_on_interact.
Added 21 components, all of which are entity variant components.
25w04aAdded the blocks_attacks, break_sound, provides_banner_patterns, provides_trim_material and tooltip_display components.
Removed the hide_tooltip and hide_additional_tooltip components in favor of the new tooltip_display component.
Removed the [Boolean] show_in_tooltip field from all components that previously had it in favor of the new tooltip_display component.
[Boolean] can_disable_blocking field in weapon component was renamed to [Float] disable_blocking_for_seconds.
Most components that used to have two fields (one of them being the [Boolean] show_in_tooltip field) now always use their simplified form, with the other one field inlined to top-level. For example: enchantments={levels:{sharpness:2}} -> enchantments={sharpness:2}
25w05aAdded [String] bypassed_by field to blocks_attacks component.
Added [Float] horizontal_blocking_angle field to objects within [NBT List / JSON Array] damage_reduction field to blocks_attacks component.
Added cow/variant entity variant component.
25w06aAdded chicken/variant entity variant component.
25w08aAdded wolf/sound_variant entity variant component.
[hide]Upcoming Java Edition
1.21.625w15aAdded optional display field to attributes_modifiers entries.
25w16aThe painting/variant component no longer allows inline paining variant definitions.

References Edit


Notes Edit

  1. For positive values larger than 0x00FFFFFF, the top byte is ignored. All negative values produce white.
  2. If the item type has special dispenser behavior, this has no effect.
  3. To be used in the built-in smithing recipes, the item must also be in the #trim_material tag.

Navigation Edit