/item and /replaceitem Command Generator
BetaChoose a player, mob or container, the slot and the item. The preview opens the inventory, lights up the slot and drops the item in, so you can check you picked the right one before copying the command.
Describe it — AI writes the command
Type what you want in plain words. The AI fills the form below, so you can see it and change anything. It follows the edition and version you picked.
Checking the AI…
Paste a command— edit it here or move it to another version
Your command · Java 26.3
64 characters/item replace entity @p armor.head with minecraft:diamond_helmet
Raw editor
How it works
A carved pumpkin on the nearest player’s head and 16 torches in the first slot of the chest below you:
Java 1.17 and later
item replace entity @p armor.head with minecraft:carved_pumpkin item replace block ~ ~-1 ~ container.0 with minecraft:torch 16 item replace entity @p armor.head from entity @s weapon.mainhand item modify entity @p weapon.mainhand my_pack:make_shiny
/item can also copy one slot into another and run an item modifier on a slot (make one with the item modifier generator). Item data goes right after the ID: components in square brackets from 1.20.5 ([unbreakable={}]), NBT in curly braces before. A slot holds up to 99 from 1.20.5, 64 before. Slots changed over time: horse.armor became armor.body in 1.20.5, horse.saddle became saddle in 1.21.5, and contents, player.cursor and player.crafting.0–3 arrived in 1.20.5.
Java 1.8 to 1.16
replaceitem entity @p armor.head minecraft:carved_pumpkin (1.13 – 1.16) replaceitem entity @p slot.armor.head minecraft:pumpkin 1 (1.8 – 1.12)
Before 1.13 slot names start with slot., the count is always written and NBT goes after a data value (1 0 {…}). Item names were different then too (carved pumpkins did not exist), so check the ID against your version. 1.8 calls the main hand slot.weapon and has no off hand.
Bedrock
replaceitem entity @p slot.armor.head 0 carved_pumpkin
replaceitem block ~ ~-1 ~ slot.container 0 torch 16
replaceitem entity @p slot.hotbar 0 keep diamond_sword 1 0 {"minecraft:item_lock":{"mode":"lock_in_slot"}}Bedrock writes the slot type and number separately. keep only fills an empty slot. The JSON at the end can lock the item in its slot or inventory and keep it on death; Bedrock has no other item data in commands, and no copying or item modifiers. slot.armor.body (wolf and horse armour) needs 1.21.20; older versions use slot.armor, which only horses have. To hand an item over normally, use /give.
FAQ
What replaced /replaceitem in Java?
/item replace, added in Java 1.17. replaceitem entity @p armor.head minecraft:diamond_helmet became item replace entity @p armor.head with minecraft:diamond_helmet. Bedrock still uses /replaceitem.
How do I put a block on a player's head?
Java: item replace entity @p armor.head with minecraft:glass. Bedrock: replaceitem entity @p slot.armor.head 0 glass. Any item works in the head slot, not just helmets.
What are the slot names?
Java: weapon.mainhand, weapon.offhand, armor.head/chest/legs/feet, armor.body, hotbar.0–8, inventory.0–26, enderchest.0–26, container.0–53, saddle, horse.0–14. Bedrock: slot.weapon.mainhand, slot.armor.head, slot.hotbar, slot.inventory, slot.enderchest, slot.container, slot.saddle, slot.armor.body, each followed by a number.
Why does /item fail on my chest?
The block must be a container (chest, barrel, hopper, shulker box…) and the slot must be container.N within its size: 0–26 for a chest, 0–4 for a hopper.
How is container.N different from hotbar and inventory?
On a player, container.0–8 is the hotbar and container.9–35 the main inventory, so container.9 and inventory.0 are the same slot.