Commands/item

Manipulate items in the inventories of blocks (chest, furnaces, etc.) or entities (players or mobs).

Syntax

 * Modifies the items in the specified slot with the specified modifier.
 * Replaces the items in the specified slot with the specified items.
 * Copies the source items to the target slot.
 * Replaces the items in the specified slot with the specified items.
 * Copies the source items to the target slot.
 * Copies the source items to the target slot.

Syntax displayed in various ways
 * {| class="collapsible collapsed collapse-button-none" data-description="simple_tree"

! style="text-align:left" | Simplified tree:
 * where substituted arguments are:
 * where substituted arguments are:
 * where substituted arguments are:
 * where substituted arguments are:
 * where substituted arguments are:
 * where substituted arguments are:
 * where substituted arguments are:
 * where substituted arguments are:


 * }
 * {| class="collapsible collapsed collapse-button-none" data-description="one_line"

! style="text-align:left" | Minimised:


 * }
 * {| class="collapsible collapsed collapse-button-none" data-description="maximised_tree"

! style="text-align:left" | Maximised:


 * }

Arguments

 * Specifies the position of the block to be modified.


 * Specifies one or more entities to modify.


 * Specifies the inventory slot to be modified. Valid values depend on whether a block or an entity is being modified.


 * For blocks, must be  where  or  is replaced with a number specifying the slot.
 * Chests, dispensers, droppers, hoppers, and trapped chests are numbered 0 for the top-left slot and then increase first horizontally, then vertically (so, for example, a chest's top row slots are numbered 0 to 8 from left to right). Double chests and double trapped chests are treated as two single container blocks.
 * A brewing stand's bottom slots are numbered 0 to 2 from left to right, its top slot is 3 and the fuel slot is 4.
 * A furnace's slots are numbered 0 for the input slot, 1 for the fuel slot, and 2 for the output slot.
 * Other blocks which hold items but don't have inventory GUIs (flower pots and jukeboxes) can only be changed with.
 * For entities, must be one of the following, where slot number or slot id is replaced with a number specifying the slot:


 * {| class="wikitable" data-description="Slot information"

!Slot !Slot Numbers !Restrictions
 * rowspan=6|armor stands, mobs, and players only (though not all mobs will show or make use of the items)
 * align="center"|0–53
 * players, item frames (slot 0), and minecarts only
 * align="center"|0–26
 * rowspan=3|players only
 * align="center"|0–8
 * align="center"|0–26
 * horses, donkeys, and mules;  must be a saddle or air to remove
 * donkeys/mules and llamas;  must be a chest or air to remove
 * rowspan="2" |
 * rowspan="2" |
 * horses;  must be a type of horse armor or air to remove
 * llamas;  must be a type of carpet or air to remove
 * rowspan="2" |
 * align="center" |0–2
 * llamas with chests
 * align="center" | 0–14
 * donkeys/mules with chests
 * align="center" |0–7
 * villagers and piglins only
 * }
 * align="center"|0–53
 * players, item frames (slot 0), and minecarts only
 * align="center"|0–26
 * rowspan=3|players only
 * align="center"|0–8
 * align="center"|0–26
 * horses, donkeys, and mules;  must be a saddle or air to remove
 * donkeys/mules and llamas;  must be a chest or air to remove
 * rowspan="2" |
 * rowspan="2" |
 * horses;  must be a type of horse armor or air to remove
 * llamas;  must be a type of carpet or air to remove
 * rowspan="2" |
 * align="center" |0–2
 * llamas with chests
 * align="center" | 0–14
 * donkeys/mules with chests
 * align="center" |0–7
 * villagers and piglins only
 * }
 * rowspan="2" |
 * rowspan="2" |
 * horses;  must be a type of horse armor or air to remove
 * llamas;  must be a type of carpet or air to remove
 * rowspan="2" |
 * align="center" |0–2
 * llamas with chests
 * align="center" | 0–14
 * donkeys/mules with chests
 * align="center" |0–7
 * villagers and piglins only
 * }
 * donkeys/mules with chests
 * align="center" |0–7
 * villagers and piglins only
 * }
 * villagers and piglins only
 * }


 * Specifies the item modifier to apply on the chosen item.


 * Specifies the item to be placed in the block or entity's inventory slot.


 * Specifies the number of items to be placed in the block or entity's inventory slot.


 * Specifies the position of the block to copy items from.


 * Specifies an entity to copy items from.


 * Specifies the inventory slot to copy the items from. Valid values depend on whether the source is block or an entity. See  argument above for more information.

Examples

 * To replace the items in the bottom-right slot of a single chest two block above with four spruce saplings:
 * To replace the items in the rightmost hotbar slot of the nearest player with four spruce saplings:
 * To replace the item in the offhand of the selected player with the item in their main hand:
 * To put a brown banner on a player's head
 * /item replace entity @s armor.head with minecraft:brown_banner
 * To put a brown banner on a player's head
 * /item replace entity @s armor.head with minecraft:brown_banner
 * /item replace entity @s armor.head with minecraft:brown_banner