Updated:
Common components (Java)
| Goal | Component |
|---|---|
| Name | custom_name |
| Description lines | lore |
| Enchantments | enchantments |
| Never breaks | unbreakable |
| Enchantment glint only | enchantment_glint_override |
| Stack size | max_stack_size |
A named sword with lore
/give @p diamond_sword[custom_name={"text":"Hero's Sword","color":"gold","italic":false},lore=[{"text":"Passed down in the kingdom","color":"gray","italic":false}],enchantments={sharpness:5,unbreaking:3}] 1
This is the Java 1.21.5+ format; earlier versions differ, so use the give generator for them. Names and lore are italic by default; "italic":false makes them upright. More on colors in item name colors.
Glint without enchantments
/give @p nether_star[enchantment_glint_override=true,custom_name="Special Ticket"] 1
Shiny but with no effect, good for event prizes and tickets.
Unbreakable tools and bigger stacks
/give @p diamond_pickaxe[unbreakable={}] 1
/give @p ender_pearl[max_stack_size=64] 64
The first pickaxe never loses durability. The second line lets ender pearls stack to 64 instead of 16; the limit is 99, and items that have durability cannot stack above 1. Both work on Java 1.20.5+.
Stat boosts while held
/give @p stick[custom_name={"text":"Magic Wand","color":"light_purple","italic":false},attribute_modifiers=[{type:"minecraft:attack_damage",amount:6,id:"mc:wand_damage",operation:"add_value",slot:"mainhand"},{type:"minecraft:movement_speed",amount:0.2,id:"mc:wand_speed",operation:"add_multiplied_base",slot:"mainhand"}]] 1
While held in the main hand, this stick adds 6 attack damage and 20% walking speed. Give each modifier a unique id. The syntax differs before 1.21.5, and 1.21.1 and older use names like generic.attack_damage. See the attribute command.
Change the look and how it is used
From Java 1.21.2 you can add item_model to borrow another item's look (item model command) and consumable to make anything edible (custom food). Together with names and lore, that is enough for one-of-a-kind adventure map items.
Detect a custom item
For "only players with a ticket may pass", tag the item with custom_data and check for it:
/give @p paper[custom_data={ticket:1b},custom_name="Entry Ticket"] 1
/execute as @a if items entity @s weapon.mainhand paper[custom_data~{ticket:1b}] run say I have a ticket
Checking the name also works, but anyone can copy a name with an anvil; custom_data cannot be faked that way. /clear can remove the item by the same tag.
Bedrock Edition
Bedrock /give cannot set names, lore or enchantments above the maximum. It can set a few behaviors:
/give @p diamond_pickaxe 1 0 {"minecraft:can_destroy":{"blocks":["stone"]},"minecraft:keep_on_death":{}}
Available fields include can_destroy, can_place_on, keep_on_death and item_lock. Name items with an anvil.
Common questions
- Several lore lines? Put several text entries inside the
lorelist; each is one line. - The items do not stack. Items with any difference in name or enchantments count as different items. Items from the same command stack.
- A new look? On Java, combine a resource pack with the
item_modelcomponent.
Check your command
The Command Error Doctor checks common syntax mistakes in your browser.