From Minecraft Wiki
Jump to: navigation, search
Information icon.svg
This feature is exclusive to Java Edition.
Grass Block JE7 BE6.png
This page describes content that may be included in a future update to Java Edition.
These features have appeared in Java Edition development versions, but the full update containing them has not been released for Java Edition yet.


First introduced

Java Edition 1.17 (20w46a)

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


item ...
... block <pos> ... or ... entity <targets> ...
... <slot> ...
... copy block <pos> <slot> [<modifier>]
... copy entity <targets> <slot> [<modifier>]
... modify <modifier>
... replace <item> [<count>]


<pos>: block_pos

Specifies the position of the block to be modified.

<targets>: entity

Specifies one or more entities to modify.

<slot>: item_slot

Specifies the inventory slot to be modified. Valid values depend on whether a block or an entity is being modified.
For blocks, must be container.<slot_number> where <slot_number> or <slotId: int> 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 /data.
For entities, must be one of the following, where slot number or slot id is replaced with a number specifying the slot:
Slot Slot Numbers Restrictions
armor.chest armor stands, mobs, and players only (though not all mobs will show or make use of the items)
container.<slot_number> 0–53 players, item frames (slot 0), and minecarts only
0–26 players only
horses, donkeys, and mules; <item> must be a saddle or air to remove
horse.chest donkeys/mules and llamas; <item> must be a chest or air to remove
horses; <item> must be a type of horse armor or air to remove
llamas; <item> must be a type of carpet or air to remove
0–2 llamas with chests
0–14 donkeys/mules with chests
0–7 villagers and piglins only

<item>: item_stack

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

<count>: integer

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

<modifier>: item_modifier

Specifies the item modifier to apply on the chosen item.


CommandTriggerJava Edition
anythe arguments are not specified correctly Unparseable
<count> exceeds the stack limit of the specified item Failed
/item block ...if the specified block is not a container Failed
if the specified block does not have the specified slot
/item entity ...if <targets> or target: target fails to resolve to one or more entities (named players must be online)
if none of the targets have the specified slot (for example, zombies don't have horse.armor)
if specified item cannot be place into the specified slot of any targeted entity(for example, place a stone into armor.chest of a player)
anyOn successReplaces the items in the specified slot with the specified items (previous items in that slot are lost).


CommandEditionSituationSuccess Count/execute store success .../execute store result ...
anyJava EditionOn fail000
/item block ...On success111
/item entity ...On success11the number of entities whose items are successfully replaced


  • To replace the items in the bottom-right slot of a single chest two block above with four spruce saplings:
    • item block ~ ~2 ~ container.26 replace minecraft:spruce_sapling 4
  • To replace the items in the rightmost hotbar slot of the nearest player with four spruce saplings:
    • item entity @p hotbar.8 replace minecraft:spruce_sapling 4
  • To replace the item in the offhand of the selected player with the item in their main hand:
    • item entity @s weapon.offhand copy entity @s weapon.mainhand


Java Edition
Upcoming Java Edition
1.1720w46aAdded /item, replacing /replaceitem

See also[edit]

  • /blockdata — can also replace items in a container
  • /entitydata — can also replace items in a mob's inventory, or modify the drop chances of armor and weapons
  • /give — give items to players without specifying specific inventory slots or overwriting other items