789 lines
30 KiB
Text
789 lines
30 KiB
Text
{{About|the new format introduced in [[Java Edition 1.20.5]]|the legacy format|Item format|the format of item components in Bedrock Edition|Item components}}
|
|
{{redirect|Component|the text format|Raw JSON text format}}
|
|
{{exclusive|java}}
|
|
{{TOC|right}}
|
|
|
|
'''Data components''', or simply '''components''', are structured data used to define and store various properties. They are used on [[item]]s, 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.dat format|player's inventory]], container [[Chunk format#Block entity format|block entities]] and [[structure file]]s.
|
|
|
|
Data components are [[Resource location|namespaced identifiers]], and can be of different data types, [[#List of components|listed here]].
|
|
|
|
== Usage ==
|
|
|
|
=== Command format ===
|
|
Data component can be used in the [[Argument types#minecraft:item_stack|item_stack]] and [[Argument types#minecraft:item_predicate|item_predicate]] argument types.
|
|
|
|
In commands that take an item_stack argument, such as {{cmd|give}}, items are represented in the format <code>''item_id''[''component1''=''value'',''component2''=''value'']</code>, with ''component'' being the [[namespaced ID]], the namespace defaulting to <code>minecraft</code>, as usual, and the ''value'' being the value of the component in [[NBT format#SNBT format|SNBT format]]. Components can be removed by prefixing them with an exclamation mark, like <code>item_id[!''component3'']</code>. If no components are specified, the square brackets can be removed, leaving just the item ID. See [[Argument types#minecraft:item_stack|item_stack]] for details.
|
|
|
|
In commands that take an item_predicate argument, such as {{cmd|clear}}, items are represented in the format <code>''item_type''[''tests'']</code>, with ''tests'' can be tests of data components or an [[item sub-predicate]]. See [[Argument types#minecraft:item_predicate|item_predicate]] for details.
|
|
|
|
=== Item format ===
|
|
Items are stored in the [[NBT format]]. Sometimes a {{nbt|byte|Slot}} tag is used to specify the slot the item is in, such as with chests; other times there is no {{nbt|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.
|
|
|
|
<div class="treeview">
|
|
{{:Item format/Item|components=the [[#List of components|list of components below]]}}
|
|
</div>
|
|
|
|
=== Block entity format ===
|
|
{{Main|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.
|
|
|
|
<div class="treeview">
|
|
* {{nbt|compound}} The root tag.
|
|
{{:Chunk format/BlockEntity|components=the [[#List of components|list of components below]]}}<!--
|
|
-->** Additional tags depending on the block entity ID. See [[Block entity format]].
|
|
</div>
|
|
|
|
== List of components ==
|
|
|
|
=== attribute_modifiers ===
|
|
|
|
<div class="treeview">
|
|
* {{nbt|compound|components}}: Parent tag.
|
|
{{/attribute modifiers}}
|
|
</div>
|
|
''Example:'' {{cmd|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.
|
|
|
|
=== banner_patterns ===
|
|
|
|
<div class="treeview">
|
|
* {{nbt|compound|components}}: Parent tag.
|
|
{{/banner patterns}}
|
|
</div>
|
|
''Example:'' {{cmd|/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 ===
|
|
|
|
<div class="treeview">
|
|
* {{nbt|compound|components}}: Parent tag.
|
|
{{/base color}}
|
|
</div>
|
|
''Example:'' {{cmd|give @s shield[base_color{{=}}"lime"]}}
|
|
* Gives a lime shield.
|
|
|
|
=== bees ===
|
|
|
|
<div class="treeview">
|
|
* {{nbt|compound|components}}: Parent tag.
|
|
{{/bees}}
|
|
</div>
|
|
''Example:'' {{cmd|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 ===
|
|
|
|
<div class="treeview">
|
|
* {{nbt|compound|components}}: Parent tag.
|
|
{{/block entity data}}
|
|
</div>
|
|
''Example:'' {{cmd|give @s spawner[block_entity_data{{=}}{id:"spawner",SpawnData:{entity:{id:"spider"<nowiki>}}</nowiki>}]}}
|
|
* Gives a spider spawner. Placing this spawner requires the player to have [[Permission level|operator permissions]].
|
|
|
|
=== block_state ===
|
|
|
|
<div class="treeview">
|
|
* {{nbt|compound|components}}: Parent tag.
|
|
{{/block state}}
|
|
</div>
|
|
''Example:'' {{cmd|give @s bamboo_slab[block_state{{=}}{type:"top"}]}}
|
|
* Gives a bamboo slab that is always placed in the top half of the block.
|
|
|
|
=== bucket_entity_data ===
|
|
|
|
<div class="treeview">
|
|
* {{nbt|compound|components}}: Parent tag.
|
|
{{/bucket entity data}}
|
|
</div>
|
|
''Example:'' {{cmd|give @s tropical_fish_bucket[bucket_entity_data{{=}}{BucketVariantTag:117506305}]}}
|
|
* Gives a bucket of tropical fish that always has the [[Tropical Fish#Names|Anemone]] type.
|
|
|
|
=== bundle_contents ===
|
|
|
|
<div class="treeview">
|
|
* {{nbt|compound|components}}: Parent tag.
|
|
{{/bundle contents}}
|
|
</div>
|
|
''Example:'' {{cmd|give @s bundle[bundle_contents{{=}}[{id:"diamond",count:2}]]}}
|
|
* Gives a bundle containing exactly 2 diamonds.
|
|
|
|
=== can_break ===
|
|
|
|
<div class="treeview">
|
|
* {{nbt|compound|components}}: Parent tag.
|
|
{{/can break}}
|
|
</div>
|
|
''Example:'' {{cmd|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.
|
|
|
|
=== can_place_on ===
|
|
|
|
<div class="treeview">
|
|
* {{nbt|compound|components}}: Parent tag.
|
|
{{/can place on}}
|
|
</div>
|
|
''Example:'' {{cmd|give @s target[can_place_on{{=}}{blocks:'sandstone'}]}}
|
|
* Gives a target block that can only be placed on sandstone.
|
|
|
|
=== charged_projectiles ===
|
|
|
|
<div class="treeview">
|
|
* {{nbt|compound|components}}: Parent tag.
|
|
{{/charged projectiles}}
|
|
</div>
|
|
''Example:'' {{cmd|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 ===
|
|
<div class="treeview">
|
|
* {{nbt|compound|components}}: Parent tag.
|
|
{{/consumable}}</div>
|
|
''Example:'' {{cmd|/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 which can be eaten in 3 seconds and upon consuming, clears all effects.
|
|
|
|
=== container ===
|
|
|
|
<div class="treeview">
|
|
* {{nbt|compound|components}}: Parent tag.
|
|
{{/container}}
|
|
</div>
|
|
''Example:'' {{cmd|give @s barrel[container{{=}}[{slot:0,item:{id:apple<nowiki>}}</nowiki>]]}}
|
|
* Gives a barrel with an apple in the first slot.
|
|
|
|
=== container_loot ===
|
|
|
|
<div class="treeview">
|
|
* {{nbt|compound|components}}: Parent tag.
|
|
{{/container loot}}
|
|
</div>
|
|
''Example:'' {{cmd|give @s chest[container_loot{{=}}{loot_table:"chests/desert_pyramid"}]}}
|
|
* Gives a chest that contains the desert pyramid loot when opened.
|
|
|
|
=== custom_data ===
|
|
|
|
<div class="treeview">
|
|
* {{nbt|compound|components}}: Parent tag.
|
|
{{/custom data}}
|
|
</div>
|
|
''Example:'' {{cmd|give @s iron_sword[custom_data{{=}}{foo:1}]}}
|
|
* Gives an iron sword with custom data <code>{foo:1}</code>.
|
|
|
|
=== custom_model_data ===
|
|
{{wip|section=1|Explain more how it works}}
|
|
<div class="treeview">
|
|
* {{nbt|compound|components}}: Parent tag.
|
|
{{/custom model data}}
|
|
</div>
|
|
''Example:''
|
|
: {{cmd|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 ===
|
|
|
|
<div class="treeview">
|
|
* {{nbt|compound|components}}: Parent tag.
|
|
{{/custom name}}
|
|
</div>
|
|
''Example:'' {{cmd|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 ===
|
|
|
|
<div class="treeview">
|
|
* {{nbt|compound|components}}: Parent tag.
|
|
{{/damage}}
|
|
</div>
|
|
''Example:'' {{cmd|give @s diamond_axe[damage{{=}}500]}}
|
|
* Gives a diamond axe with 500 points of damage.
|
|
|
|
=== damage_resistant ===
|
|
<div class="treeview">
|
|
* {{nbt|compound|components}}: Parent tag.
|
|
{{/damage_resistant}}
|
|
</div>
|
|
|
|
=== debug_stick_state ===
|
|
|
|
<div class="treeview">
|
|
* {{nbt|compound|components}}: Parent tag.
|
|
{{/debug stick state}}
|
|
</div>
|
|
''Example:'' {{cmd|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 <code>west</code> and the [[candle]] block state property set to <code>lit</code>.
|
|
|
|
=== death_protection ===
|
|
<div class="treeview">
|
|
* {{nbt|compound|components}}: Parent tag.
|
|
{{/death_protection}}</div>
|
|
''Example:'' {{cmd|/give @s nether_star[death_protection{{=}}{death_effects:[{type:'minecraft:clear_all_effects'}]}]}}
|
|
* Gives a nether star which protects the holder from death and when did so, removes all status effects from the holder.
|
|
|
|
=== dyed_color ===
|
|
|
|
<div class="treeview">
|
|
* {{nbt|compound|components}}: Parent tag.
|
|
{{/dyed color}}
|
|
</div>
|
|
''Example:'' {{cmd|give @s leather_helmet[dyed_color{{=}}{rgb:456345,show_in_tooltip:false}]}}
|
|
* Gives a blueish-green leather helmet that does not display <code>''Dyed''</code> in the tooltip.
|
|
|
|
{{Calculator|decimalColor}}
|
|
|
|
=== enchantable ===
|
|
<div class="treeview">
|
|
* {{nbt|compound|components}}: Parent tag.
|
|
{{/enchantable}}
|
|
</div>
|
|
''Example:'' {{cmd|/give @s elytra[enchantable{{=}}{value:15}]}}
|
|
* Gives an elytra that can be enchanted in an enchanting table with an enchantment value of 15.
|
|
|
|
=== enchantment_glint_override ===
|
|
|
|
<div class="treeview">
|
|
* {{nbt|compound|components}}: Parent tag.
|
|
{{/enchantment glint override}}
|
|
</div>
|
|
''Example:'' {{cmd|give @s experience_bottle[enchantment_glint_override{{=}}false]}}
|
|
* Gives an experience bottle without the visual enchantment glint, which is otherwise applied by default.
|
|
|
|
=== enchantments ===
|
|
<div class="treeview">
|
|
* {{nbt|compound|components}}: Parent tag.
|
|
{{/enchantments}}
|
|
</div>
|
|
''Example:'' {{cmd|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 [[Data component format#stored enchantments|{{cd|minecraft:stored_enchantments}}]] component, which is used to add inactive enchantments, such as with [[Enchanted Book|enchanted books]].
|
|
|
|
To illustrate the difference, hitting an entity with an {{cd|enchanted_book[enchantments{{=}}{knockback:2}]}} would knock any entity hit per knockback II while hitting an entity with an {{cd|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 ===
|
|
|
|
<div class="treeview">
|
|
* {{nbt|compound|components}}: Parent tag.
|
|
{{/entity data}}
|
|
</div>
|
|
''Example:'' {{cmd|give @s armor_stand[entity_data{{=}}{id:"armor_stand",Small:1b}]}}
|
|
* Gives an armor stand that is small when placed down.
|
|
|
|
=== equippable ===
|
|
<div class="treeview">
|
|
* {{nbt|compound|components}}: Parent tag.
|
|
{{/equippable}}
|
|
</div>
|
|
''Example:'' {{cmd|/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.
|
|
|
|
=== firework_explosion ===
|
|
|
|
<div class="treeview">
|
|
* {{nbt|compound|components}}: Parent tag.
|
|
{{/firework explosion}}
|
|
</div>
|
|
|
|
=== fireworks ===
|
|
|
|
<div class="treeview">
|
|
* {{nbt|compound|components}}: Parent tag.
|
|
{{/fireworks}}
|
|
</div>
|
|
|
|
=== food ===
|
|
|
|
<div class="treeview">
|
|
* {{nbt|compound|components}}: Parent tag.
|
|
{{/food}}
|
|
</div>
|
|
''Example 1:'' {{cmd|give @s melon_slice[food{{=}}{nutrition:3,saturation:1,can_always_eat:true}]}}
|
|
* Gives a melon slice which can be eaten at any time and restores 3 food points and 1 saturation.
|
|
''Example 2:'' {{cmd|give @s minecraft:sponge[consumable{{=}}{consume_seconds:2.4},food{{=}}{nutrition:5,saturation:5,can_always_eat:true}]}}
|
|
* Gives a sponge which can be eaten at any time, takes 2.4 seconds to consume, and restores 5 food points and 5 saturation.
|
|
|
|
=== glider ===
|
|
<div class="treeview">
|
|
* {{nbt|compound|components}}: Parent tag.
|
|
{{/glider}}
|
|
</div>
|
|
''Example:'' {{cmd|/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.
|
|
|
|
=== hide_additional_tooltip ===
|
|
|
|
<div class="treeview">
|
|
* {{nbt|compound|components}}: Parent tag.
|
|
{{/hide_additional_tooltip}}
|
|
</div>
|
|
''Example:'' {{cmd|give @s ominous_bottle[hide_additional_tooltip{{=}}{}]}}
|
|
* Gives an ominous bottle without the additional tooltip (the ''status effect'' is now hidden under the name).
|
|
|
|
=== hide_tooltip ===
|
|
|
|
<div class="treeview">
|
|
* {{nbt|compound|components}}: Parent tag.
|
|
{{/hide tooltip}}
|
|
</div>
|
|
''Example:'' {{cmd|give @p dirt[hide_tooltip{{=}}{}]}}
|
|
* Gives a dirt block with no tooltip whatsoever.
|
|
|
|
=== instrument ===
|
|
|
|
<div class="treeview">
|
|
* {{nbt|compound|components}}: Parent tag.
|
|
{{/instrument}}
|
|
</div>
|
|
''Example:'' {{cmd|give @s goat_horn[instrument{{=}}"feel_goat_horn"]}}
|
|
* Gives a [[goat horn]] that plays the ''Feel'' sound.
|
|
|
|
=== intangible_projectile ===
|
|
|
|
<div class="treeview">
|
|
* {{nbt|compound|components}}: Parent tag.
|
|
{{/intangible projectile}}
|
|
</div>
|
|
''Example:'' {{cmd|1=give @s arrow[intangible_projectile={}]}}
|
|
* Gives an arrow that cannot be picked up by the player
|
|
|
|
=== item_model ===
|
|
<div class="treeview">
|
|
* {{nbt|compound|components}}: Parent tag.
|
|
{{/item_model}}
|
|
</div>
|
|
''Example:'' {{cmd|/give @s netherite_sword[item_model{{=}}"minecraft:diamond_sword"]}}
|
|
* Gives a netherite sword that looks like a diamond sword.
|
|
|
|
=== item_name ===
|
|
|
|
<div class="treeview">
|
|
* {{nbt|compound|components}}: Parent tag.
|
|
{{/item name}}
|
|
</div>
|
|
|
|
=== jukebox_playable ===
|
|
<div class="treeview">
|
|
* {{nbt|compound|components}}: Parent tag.
|
|
{{/jukebox_playable}}
|
|
</div>
|
|
''Example:'' {{cmd|1=give @s diamond[minecraft:jukebox_playable={song:"pigstep"}]}}
|
|
* Gives a diamond that plays Pigstep when inserted into a jukebox
|
|
|
|
=== lock ===
|
|
|
|
<div class="treeview">
|
|
* {{nbt|compound|components}}: Parent tag.
|
|
{{/lock}}
|
|
</div>
|
|
''Example:'' {{cmd|give @p chest[minecraft:lock{{=}}{components:{"minecraft:item_model":"minecraft:diamond"<nowiki>}}]</nowiki>}}
|
|
* Gives a chest that is locked, opening only if the player is holding an item with the same model as a Diamond.
|
|
''Example:'' {{cmd|give @p furnace[minecraft:lock{{=}}{components:{"minecraft:custom_name":"'Furnace Key'"<nowiki>}}]</nowiki>}}
|
|
* Gives a furnace that opens only if the player is holding an item with the custom name "Furnace Key".
|
|
''Example:'' {{cmd|give @p barrel[minecraft:lock{{=}}{items:["minecraft:oak_planks","minecraft:diamond"],count:6,predicates:{custom_data:{bar:foo<nowiki>}}</nowiki>}]}}
|
|
* Gives a barrel that opens only if the player is holding exactly 6 [[Planks#Oak|oak planks]] or 6 [[diamond]]s that has the custom data {{cd|bar:foo}}
|
|
|
|
=== lodestone_tracker ===
|
|
|
|
<div class="treeview">
|
|
* {{nbt|compound|components}}: Parent tag.
|
|
{{/lodestone tracker}}
|
|
</div>
|
|
''Example:'' {{cmd|1=give @s compass[minecraft:lodestone_tracker={target:{pos:[I;1,2,3],dimension:"overworld"<nowiki>}}</nowiki>]}}
|
|
* Gives a compass that points towards a lodestone that is located in the Overworld at x=1,y=2,z=3
|
|
|
|
=== lore ===
|
|
|
|
<div class="treeview">
|
|
* {{nbt|compound|components}}: Parent tag.
|
|
{{/lore}}
|
|
</div>
|
|
''Example:'' {{cmd|give @p stick[lore{{=}}['{text:"This Stick is very sticky."}']]}}
|
|
* Gives a stick with lore in its tooltip.
|
|
''Example:'' {{cmd|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:'' {{cmd|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 ===
|
|
|
|
<div class="treeview">
|
|
* {{nbt|compound|components}}: Parent tag.
|
|
{{/map color}}
|
|
</div>
|
|
''Example:'' {{cmd|give @s filled_map[map_color{{=}}16711680]}}
|
|
* Gives a filled map with red markings on item texture.
|
|
{{Calculator|decimalColor}}
|
|
|
|
=== map_decorations ===
|
|
|
|
<div class="treeview">
|
|
* {{nbt|compound|components}}: Parent tag.
|
|
{{/map decorations}}
|
|
</div>
|
|
|
|
=== map_id ===
|
|
|
|
<div class="treeview">
|
|
* {{nbt|compound|components}}: Parent tag.
|
|
{{/map id}}
|
|
</div>
|
|
|
|
=== max_damage ===
|
|
|
|
<div class="treeview">
|
|
* {{nbt|compound|components}}: Parent tag.
|
|
{{/max damage}}
|
|
</div>
|
|
''Example:'' {{cmd|give @s diamond_pickaxe[max_damage{{=}}4]}}
|
|
* Gives a diamond pickaxe that can only be used 4 times before breaking.
|
|
|
|
=== max_stack_size ===
|
|
|
|
<div class="treeview">
|
|
* {{nbt|compound|components}}: Parent tag.
|
|
{{/max stack size}}
|
|
</div>
|
|
''Example:'' {{cmd|give @s acacia_boat[max_stack_size{{=}}64] 5}}
|
|
* Gives a stack of 5 acacia boats all in a single slot.
|
|
|
|
=== note_block_sound ===
|
|
|
|
<div class="treeview">
|
|
* {{nbt|compound|components}}: Parent tag.
|
|
{{/note block sound}}
|
|
</div>
|
|
''Example:'' {{cmd|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 ===
|
|
|
|
<div class="treeview">
|
|
* {{nbt|compound|components}}: Parent tag.
|
|
{{/ominous bottle amplifier}}
|
|
</div>
|
|
|
|
=== pot_decorations ===
|
|
|
|
<div class="treeview">
|
|
* {{nbt|compound|components}}: Parent tag.
|
|
{{/pot decorations}}
|
|
</div>
|
|
''Example:'' {{cmd|1=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 ===
|
|
|
|
<div class="treeview">
|
|
* {{nbt|compound|components}}: Parent tag.
|
|
{{/potion contents}}
|
|
</div>
|
|
|
|
{{Calculator|decimalColor}}
|
|
|
|
=== profile ===
|
|
|
|
<div class="treeview">
|
|
* {{nbt|compound|components}}: Parent tag.
|
|
{{/profile}}
|
|
</div>
|
|
''Example:'' {{cmd|give @p player_head[profile{{=}}MinecraftWiki]}}
|
|
* Gives a player head of MinecraftWiki.
|
|
{{Calculator|playerUuid}}
|
|
|
|
=== rarity ===
|
|
|
|
<div class="treeview">
|
|
* {{nbt|compound|components}}: Parent tag.
|
|
{{/rarity}}
|
|
</div>
|
|
''Example:'' {{cmd|give @p iron_sword[rarity{{=}}epic]}}
|
|
* Gives an iron sword with a purple name.
|
|
|
|
=== recipes ===
|
|
|
|
<div class="treeview">
|
|
* {{nbt|compound|components}}: Parent tag.
|
|
{{/recipes}}
|
|
</div>
|
|
''Example:'' {{cmd|give @p knowledge_book[recipes{{=}}["minecraft:end_crystal","minecraft:diamond","minecraft:stone_sword","minecraft:blast_furnace"]]}}
|
|
* Gives a Knowledge Book which, when used, gives the player the recipes listed inside the component.
|
|
|
|
=== repairable ===
|
|
<div class="treeview">
|
|
* {{nbt|compound|components}}: Parent tag.
|
|
{{/repairable}}
|
|
</div>
|
|
''Example:'' {{cmd|/give @s diamond_sword[repairable{{=}}{items:"stick"}]}}
|
|
* Gives a diamond sword that can be repaired with sticks in an anvil.
|
|
|
|
=== repair_cost ===
|
|
|
|
<div class="treeview">
|
|
* {{nbt|compound|components}}: Parent tag.
|
|
{{/repair cost}}
|
|
</div>
|
|
|
|
=== stored_enchantments ===
|
|
|
|
<div class="treeview">
|
|
* {{nbt|compound|components}}: Parent tag.
|
|
{{/stored enchantments}}
|
|
</div>
|
|
|
|
=== suspicious_stew_effects ===
|
|
|
|
<div class="treeview">
|
|
* {{nbt|compound|components}}: Parent tag.
|
|
{{/suspicious stew effects}}
|
|
</div>
|
|
|
|
=== tool ===
|
|
|
|
<div class="treeview">
|
|
* {{nbt|compound|components}}: Parent tag.
|
|
{{/tool}}
|
|
</div>
|
|
''Example:'' {{cmd|give @s 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}]}] 1}}
|
|
* Gives an [[oak fence]] that has the properties of a [[pickaxe]].
|
|
|
|
=== tooltip_style ===
|
|
<div class="treeview">
|
|
* {{nbt|compound|components}}: Parent tag.
|
|
{{/tooltip_style}}
|
|
</div>
|
|
|
|
=== trim ===
|
|
|
|
<div class="treeview">
|
|
* {{nbt|compound|components}}: Parent tag.
|
|
{{/trim}}
|
|
</div>
|
|
|
|
=== unbreakable ===
|
|
|
|
<div class="treeview">
|
|
* {{nbt|compound|components}}: Parent tag.
|
|
{{/unbreakable}}
|
|
</div>
|
|
|
|
=== use_cooldown ===
|
|
<div class="treeview">
|
|
* {{nbt|compound|components}}: Parent tag.
|
|
{{/use_cooldown}}
|
|
</div>
|
|
''Example:'' {{cmd|/give @s 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 <code>cooldown_group</code>.
|
|
** If other items in the inventory share the same <code>cooldown_group</code>, but have different <code>seconds</code>, then using that item applies the <code>seconds</code> of ''itself'' to all other items in the inventory, rather than each item applying their own <code>seconds</code> to themselves.
|
|
* Items can have their cooldowns disabled completely by removing the component with <code>[!use_cooldown]</code>.
|
|
|
|
=== use_remainder ===
|
|
<div class="treeview">
|
|
* {{nbt|compound|components}}: Parent tag.
|
|
{{/use_remainder}}
|
|
</div>
|
|
''Example:'' {{cmd|/give @s splash_potion[use_remainder{{=}}{id:"minecraft:gunpowder"}]}}
|
|
* Gives a splash potion, which after being thrown, leaves gunpowder.
|
|
''Example:'' {{cmd|/give @s 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".
|
|
|
|
=== writable_book_content ===
|
|
|
|
<div class="treeview">
|
|
* {{nbt|compound|components}}: Parent tag.
|
|
{{/writable book content}}
|
|
</div>
|
|
|
|
=== written_book_content ===
|
|
|
|
<div class="treeview">
|
|
* {{nbt|compound|components}}: Parent tag.
|
|
{{/written book content}}
|
|
</div>
|
|
|
|
== Non-encoded components ==
|
|
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 {{cmd|data}}.
|
|
|
|
=== creative_slot_lock ===
|
|
|
|
<div class="treeview">
|
|
* {{nbt|compound|components}}: Parent tag.
|
|
** {{nbt|compound|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.
|
|
</div>
|
|
|
|
=== map_post_processing ===
|
|
|
|
<div class="treeview">
|
|
* {{nbt|compound|components}}: Parent tag.
|
|
** {{nbt|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.
|
|
</div>
|
|
|
|
== Temporary components ==
|
|
The following components were added and used in the [[April Fools' Day jokes|April Fools' Day joke]] snapshot [[24w14potato]] in 2024.
|
|
|
|
{{Collapse|title=List of the components|head=1}}
|
|
=== clicks ===
|
|
|
|
<div class="treeview">
|
|
* {{nbt|compound|components}}: Parent tag.
|
|
** {{nbt|int|minecraft:clicks}}: The number of times this [[poisonous potato plant]] has been clicked in the inventory.
|
|
</div>
|
|
|
|
=== contacts_messages ===
|
|
|
|
<div class="treeview">
|
|
* {{nbt|compound|components}}: Parent tag.
|
|
** {{nbt|long-array|minecraft:contacts_messages}}: Used by the [[poisonous potato plant]].
|
|
</div>
|
|
|
|
=== explicit_foil ===
|
|
|
|
<div class="treeview">
|
|
* {{nbt|compound|components}}: Parent tag.
|
|
** {{nbt|boolean|minecraft:explicit_foil}}: Whether or not this item should display a glint.
|
|
</div>
|
|
|
|
=== fletching ===
|
|
|
|
<div class="treeview">
|
|
* {{nbt|compound|components}}: Parent tag.
|
|
** {{nbt|compound|minecraft:fletching}}: Information about this [[fletching table]].
|
|
*** {{nbt|string|quality}}: A single character defining the quality of this block.
|
|
*** {{nbt|string|impurities}}: A single character defining the impurity of this block.
|
|
*** {{nbt|string|next_level_impurities}}: A single character defining the impurity of the next level of this block.
|
|
*** {{nbt|short|processs_time}}: The process time of this block, in ticks.
|
|
*** {{nbt|boolean|explored}}: Whether this block has been explored.
|
|
</div>
|
|
|
|
=== heat ===
|
|
|
|
<div class="treeview">
|
|
* {{nbt|compound|components}}: Parent tag.
|
|
** {{nbt|compound|minecraft:heat}}: Information about this [[hot potato]].
|
|
*** {{nbt|int|heat}}: The amount of heat. Has a maximum value of 200.
|
|
*** {{nbt|int|slot}}: The inventory slot this item is in.
|
|
*** {{nbt|int-array|owner}}: The UUID of the entity currently holding this item.
|
|
</div>
|
|
|
|
=== hovered ===
|
|
|
|
<div class="treeview">
|
|
* {{nbt|compound|components}}: Parent tag.
|
|
** {{nbt|boolean|minecraft:hovered}}: Whether or not this [[poisonous potato plant]] is the last item stack hovered in the inventory.
|
|
</div>
|
|
|
|
=== lubrication ===
|
|
|
|
<div class="treeview">
|
|
* {{nbt|compound|components}}: Parent tag.
|
|
** {{nbt|compound|minecraft:lubrication}}
|
|
*** {{nbt|int|level}}: The level of slipperiness this item has when thrown on the ground.
|
|
</div>
|
|
|
|
=== potato_bane ===
|
|
|
|
<div class="treeview">
|
|
* {{nbt|compound|components}}: Parent tag.
|
|
** {{nbt|compound|minecraft:potato_bane}}: Used by the [[potato peeler]].
|
|
*** {{nbt|float|damage_boost}}: The amount of bonus damage applied to potato mobs.
|
|
</div>
|
|
|
|
=== resin ===
|
|
|
|
<div class="treeview">
|
|
* {{nbt|compound|components}}: Parent tag.
|
|
** {{nbt|compound|minecraft:resin}}: Information about this [[toxic resin]].
|
|
*** {{nbt|string|quality}}: A single character defining the quality of this item. Used to prefix the "Clarity" line on the tooltip.
|
|
*** {{nbt|string|impurities}}: A single character defining the impurity of this item. Used to prefix the "Impurities" line on the tooltip.
|
|
</div>
|
|
|
|
=== secret_message ===
|
|
|
|
<div class="treeview">
|
|
* {{nbt|compound|components}}: Parent tag.
|
|
** {{nbt|long|minecraft:secret_message}}: Used by the [[poisonous potato plant]].
|
|
</div>
|
|
|
|
=== snek ===
|
|
|
|
<div class="treeview">
|
|
* {{nbt|compound|components}}: Parent tag.
|
|
** {{nbt|compound|minecraft:snek}}: Information about this [[snektato]].
|
|
*** {{nbt|boolean|revealed}}: Whether or not this item has been eaten yet. When {{cd|true}}, its name is "Venomous Potato" and its texture is different.
|
|
</div>
|
|
|
|
=== undercover_id ===
|
|
|
|
<div class="treeview">
|
|
* {{nbt|compound|components}}: Parent tag.
|
|
** {{nbt|int|minecraft:undercover_id}}: Used by the [[poisonous potato plant]].
|
|
</div>
|
|
|
|
=== views ===
|
|
|
|
<div class="treeview">
|
|
* {{nbt|compound|components}}: Parent tag.
|
|
** {{nbt|int|minecraft:views}}: Used by the [[poisonous potato plant]].
|
|
</div>
|
|
|
|
=== xp ===
|
|
|
|
<div class="treeview">
|
|
* {{nbt|compound|components}}: Parent tag.
|
|
** {{nbt|int|minecraft:xp}}: The amount of experience points granted by this [[potato of knowledge]].
|
|
</div>
|
|
{{Collapse|tail=1}}
|
|
|
|
== History ==
|
|
{{HistoryTable
|
|
|{{HistoryLine|java}}
|
|
|{{HistoryLine||1.20.5|dev=24w09a|Replaced {{nbt|compound|tag}} tag and all underlying item-specific tags with data components.
|
|
|Replaced {{nbt|byte|Count}} with {{nbt|int|count}}.}}
|
|
|{{HistoryLine|||dev=24w10a|Renamed {{cd|lodestone_target}} component to {{cd|lodestone_tracker}}, and moved {{nbt|int-array|pos}} and {{nbt|string|dimension}} fields to {{nbt|compound|target}}.
|
|
|{{cd|d=and|profile|dyed_color|attribute_modifiers|potion_contents|enchantments|stored_enchantments}} components can now optionally be defined in simpler formats.
|
|
|{{cd|lore}} and {{cd|fireworks}} components now allow up to 256 entries in their list.
|
|
|{{cd|container}} component now applies to all [[container]]s, instead of only [[shulker box]]es.
|
|
|{{nbt|string|name}} is no longer required in {{cd|profile}} component.}}
|
|
|{{HistoryLine|||dev=24w12a|Added {{cd|d=and|food|max_stack_size|max_damage|fire_resistant|rarity|tool|hide_tooltip}} components.
|
|
|The old <code>{...}</code> item format has been removed, and can no longer be used as a shortcut for {{cd|custom_data}} component.}}
|
|
|{{HistoryLine|||dev=24w13a|Added {{cd|d=and|item_name|ominous_bottle_amplifier}} components.
|
|
|Components with non-default values on block items are now stored on block entities when placed.}}
|
|
|{{HistoryLine|||dev=24w14a|Renamed {{nbt|string|text}} to {{nbt|string|raw}} in {{cd|d=and|writable_book_content|written_book_content}} components.}}
|
|
|{{HistoryLine|||dev=Pre-Release 1|Renamed {{nbt|float|saturation_modifier}} to {{nbt|float|saturation}} in {{cd|food}} component.
|
|
|{{cd|d=and|max_damage|max_stack_size}} components can no longer be put together.}}
|
|
|{{HistoryLine||1.21|dev=24w19a|{{cd|custom_data}} component can now be defined as a SNBT string.
|
|
|Added {{nbt|compound|using_converts_to}} in {{cd|food}} component.}}
|
|
|{{HistoryLine|||dev=24w21a|Added {{cd|jukebox_playable}} component.
|
|
|Changed {{cd|attribute_modifiers}} component: removed {{nbt|string|name}} and {{nbt|int-array|uuid}} fields, added {{nbt|string|id}} field.}}
|
|
|{{HistoryLine||1.21.2|dev=24w33a|Added <code>repairable</code> and <code>enchantable</code> components.
|
|
|The title specified in the <code>written_book_content</code> component is now prioritized over <code>custom_name</code> and <code>item_name</code> for any item with a non-empty title in this component.}}
|
|
|{{HistoryLine|||dev=24w34a|Added <code>consumable</code>, <code>use_cooldown</code> and <code>use_remainder</code> components.
|
|
|The <code>food</code> component has been changed to become a data container which only holds the food stats applied when the item is consumed. The component no longer gives the item the ability to be consumed. Removed the {{nbt|float|eat_seconds}}, {{nbt|compound|using_converts_to}} and {{nbt|list|effects}} fields from <code>food</code>.}}
|
|
|{{HistoryLine|||dev=24w36a|Added <code>equippable</code>, <code>item_model</code>, <code>glider</code> and <code>tooltip_style</code> components.
|
|
|The <code>item_name</code> component is now always present on every item.}}
|
|
|{{HistoryLine|||dev=24w37a|Added <code>death_protection</code> component.
|
|
|Renamed <code>fire_resistant</code> component to <code>damage_resistant</code>, and added {{nbt|string|types}} field.
|
|
|The name provided by the <code>item_name</code> component now always has the lowest priority.
|
|
|Added {{nbt|string|custom_name}} in <code>potion_contents</code> component.
|
|
|Added {{nbt|boolean|swappable}} and {{nbt|boolean|damage_on_hurt}} in <code>equippable</code> component.}}
|
|
|{{HistoryLine|||dev=Pre-Release 1|Added {{nbt|string|camera_overlay}} in <code>equippable</code> component.}}
|
|
|{{HistoryLine||1.21.4|dev=24w45a|{{cd|minecraft:custom_model_data}} now has more fields to accomodate new uses by various model property getters: {{cd|floats}}, {{cd|flags}}, {{cd|strings}} and {{cd|colors}}.}}
|
|
}}
|
|
|
|
== References ==
|
|
{{reflist}}
|
|
|
|
== Navigation ==
|
|
{{Navbox Java Edition technical|general}}
|
|
|
|
[[Category:Development]]
|
|
|
|
[[de:Gegenstandsdaten]]
|
|
[[fr:Format de composant de données]]
|
|
[[ja:アイテムフォーマット]]
|
|
[[pt:Formato de componente de dado]]
|
|
[[uk:Формат компонента даних]]
|
|
[[zh:物品堆叠组件]]
|