How To Use The Item Command Wiki Guide
This Minecraft tutorial explains how to use the /item command with screenshots and step-by-step instructions.
You can use the /item command to instanty replace one item with another item. You can replace armor items worn, weapons held in your hands, items stored in chests and items in your inventory/hotbar. This is a great way to quickly put armor on a player during a Minecraft battle or change out a worn out weapon.
TIP: Starting in Minecraft Java Edition (PC/Mac) 1.17, the /item command replaces the /replaceitem command in Java Edition only!
Let’s explore how to use this cheat (game command).
Requirements
To run game commands in Minecraft, you have to turn cheats on in your world.
Item Command
Item Command in Minecraft Java Edition (PC/Mac)
In Minecraft Java Edition (PC/Mac) , the /item command has different syntaxes depending on what you would like to do.
To replace the item in a specified slot of a block with another item:
/item replace block <pos> <slot> with <item> [count]
To replace the item in a specified slot of a block from the slot of another block:
/item replace block <pos> <slot> from block <sourcePos> <sourceSlot> [modifier]
To replace the item in a specified slot of a block from the slot of another entity:
/item replace block <pos> <slot> from entity <sourceTarget> <sourceSlot> [modifier]
To replace the item in a specified slot of an entity with another item:
/item replace entity <target> <slot> with <item> [count]
To replace the item in a specified slot of an entity from the slot of another block:
/item replace entity <target> <slot> from block <sourcePos> <sourceTarget> <sourceSlot> [modifier]
To replace the item in a specified slot of an entity from the slot of another entity:
/item replace entity <target> <slot> from entity <sourceTarget> <sourceSlot> [modifier]
To modify the item in a specified slot of an entity:
/item modify entity <target> <slot> <modifier>
To modify the item in the specified slot of a block:
/item modify block <pos> <slot> <modifier>
Definitions
- pos is the x y z coordinate of the block to replace.
- sourcePos is the x y z coordinate of the block you wish to copy an item from.
- target is the name of the player (or a target selector) that you wish to replace an item for.
- sourceTarget is the name of the player (or a target selector) that you wish to copy an item from.
- slot and sourceSlot are slot types. The slot is the destination slot and the sourceSlot is the slot to copy an item from. You can use the following:
slot Description armor.chest Replace the chest armor item on a player, mob or armor stand armor.feet Replace the feet armor item on a player, mob or armor stand armor.head Replace the head armor item on a player, mob or armor stand armor.legs Replace the leg armor item on a player, mob or armor stand container.number Replace an item in a chest
(number between 0 and 53 to indicate the slot position in the container)enderchest.number Replace an item in an ender chest
(number between 0 and 26 to indicate the slot position in the ender chest)horse.number Replace an item in the chest of a mule, donkey or llama
(number between 0 and 14 to indicate the slot position in the chest)horse.armor Replace the armor on a horse horse.chest Replace the chest on a horse, mule, donkey, or llama horse.saddle Replace the saddle on a horse, mule or donkey hotbar.number Replace a hotbar item
(number between 0 and 8 to indicate the slot position in the hotbar)inventory.number Replace an inventory item
(number between 0 and 26 to indicate the inventory position)villager.number Replace an item for a villager
(number between 0 and 7)weapon Replace the weapon of the player or mob weapon.mainhand Replace the weapon held in the main hand of the player or mob weapon.offhand Replace the weapon held in the offhand of the player or mob - item is the name of the replacement item.
- count is optional. It is the amount of the replacement item. If you don’t specify an amount, it will default to 1.
- modifier is the name of an item modifier which is a data pack file. For example:Â
my_namespace:upgrade_sword
.
Examples
Example in Java Edition (PC/Mac)
To replace the head armor item with a netherite helmet for the player called 9Minecraft:
/item replace entity 9Minecraft armor.head with diamond_helmet
To put a saddle on all donkeys:
/item replace entity @e[type=donkey] horse.saddle with saddle
To replace the weapon in the main hand of all drowned with a trident:
/item replace entity @e[type=drowned] weapon.mainhand with trident
To put a netherite_pickaxe in the first slot of a chest (the chest is directly below you):
/item replace block ~ ~-1 ~ container.0 with netherite_pickaxe
How to Enter the Command
1. Open the Chat Window
The easiest way to run a command in Minecraft is within the chat window. The game control to open the chat window depends on the version of Minecraft:
- For Java Edition (PC/Mac), press the T key to open the chat window.
2. Type the Command
In this example, we are going to equip a diamond helmet on the player called 9Minecraft with the following command:
/item replace entity 9Minecraft armor.head with diamond_helmet
Type the command in the chat window and press the Enter key to run the command.
Once the cheat has been entered, the item will be replaced.
Once you have entered the command, you will see the message “Replaced a slot on 9Minecraft with [Diamond Helmet]” appear in the lower left corner of the game window. This indicates that that slot that has been replaced with a diamond helmet.
As you can see, the diamond helmet is now being worn by 9Minecraft.
Congratulations, you have learned how to use the /item command in Minecraft.