/item
Replace or modify the item in a specific inventory or equipment slot.
Overview
What is the /item command?
The /item command modifies or replaces items in inventory or equipment slots, and can apply loot tables and item modifiers. It's the modern, flexible successor to /replaceitem, able to copy items between slots and transform them with datapack modifiers.
It's used for precise inventory setups, equipping mobs, and advanced datapack item manipulation.
When to use it: Use /item to set, replace or modify items in specific inventory or armor slots โ including on mobs.
At a glance
Syntax
/item replace <target> <slot> with <item>See it
What it does
Anatomy
Every part, explained
- 1
CommandRequired/item replaceSwaps the item in a slot. Also has 'modify'.
- 2
TargetRequired<target>Who or what gets the item, e.g. entity @s.
- 3
SlotRequired<slot>The slot to fill, e.g. weapon.mainhand.
- 4
ItemRequiredwith <item>The item to place, e.g. diamond_sword.
Your turn
Try it yourself
Copy & paste
Examples
/item replace entity @s weapon.mainhand with diamond_swordPut a sword in your main hand.
/item replace entity @s armor.head with diamond_helmetEquip a diamond helmet.
/item replace entity @s hotbar.0 with golden_apple 16Fill the first hotbar slot with 16 golden apples.
Avoid these
Common mistakes
/item replace @s weapon.mainhand with stick/item replace entity @s weapon.mainhand with stickSay 'entity' or 'block' before the target.
/item replace entity @s mainhand with stick/item replace entity @s weapon.mainhand with stickHand slots are weapon.mainhand and weapon.offhand.
Good to know
Frequently asked questions
- How do you put an item in a specific slot?
- Run /item replace entity @s <slot> with <item>, e.g. /item replace entity @s weapon.mainhand with diamond_sword.
- How do you equip armor on a mob with a command?
- Target the mob's armor slot, e.g. /item replace entity @e[type=zombie,limit=1] armor.head with diamond_helmet.
- What replaced the /replaceitem command?
- /item replace does everything /replaceitem did, plus copying and modifying items, so /replaceitem was retired in favour of it.
Keep going