Edit Block and Entity Inventories with /item
The /item command in Minecraft Java Edition lets you directly control what is inside the inventory slots of blocks and entities. You can place new items, copy items from one inventory to another, or apply item modifiers to existing slots.
Players and mapmakers use this command when they need to equip mobs, update chest contents, or change what a player is holding. It requires permission level 2, meaning you must be an operator or have cheats enabled in single-player.
/item fill block <target> <slots> from block <source> <sourceSlots> [<modifier>]/item fill block <target> <slots> from entity <source> <sourceSlots> [<modifier>]/item fill block <target> <slots> with <item> [<count>]/item fill entity <target> <slots> from block <source> <sourceSlots> [<modifier>]/item fill entity <target> <slots> from entity <source> <sourceSlots> [<modifier>]/item fill entity <target> <slots> with <item> [<count>]/item modify block <target> <slots> <modifier>/item modify entity <target> <slots> <modifier>/item override block <target> <slots> from block <source> <sourceSlots> [<modifier>]/item override block <target> <slots> from entity <source> <sourceSlots> [<modifier>]/item override block <target> <slots> with <item> [<count>]/item override entity <target> <slots> from block <source> <sourceSlots> [<modifier>]/item override entity <target> <slots> from entity <source> <sourceSlots> [<modifier>]/item override entity <target> <slots> with <item> [<count>]/item replace block <target> <slots> from block <source> <sourceSlots> [<modifier>]/item replace block <target> <slots> from entity <source> <sourceSlots> [<modifier>]/item replace block <target> <slots> with <item> [<count>]/item replace entity <target> <slots> from block <source> <sourceSlots> [<modifier>]/item replace entity <target> <slots> from entity <source> <sourceSlots> [<modifier>]/item replace entity <target> <slots> with <item> [<count>]/item replace entity <target> <slots> with <item> [<count>]/item replace block <target> <slots> with <item> [<count>]/item replace entity <target> <slots> from entity <source> <sourceSlots> [<modifier>]/item fill block <target> <slots> with <item> [<count>]/item fill entity <target> <slots> from block <source> <sourceSlots> [<modifier>]/item override entity <target> <slots> with <item> [<count>]/item modify entity <target> <slots> <modifier>/item modify block <target> <slots> <modifier>| Argument | Type | What it means |
|---|---|---|
<target> | block position | Three coordinates x y z. Use ~ for relative or ^ for local coordinates. |
<slots> | slot source | A slot source indicating which inventory slots on the target will be changed. |
<source> | block position | Three coordinates x y z. Use ~ for relative or ^ for local coordinates. |
<sourceSlots> | slot source | A slot source specifying which inventory slots on the source to read items from. |
<modifier> | item modifier | An item modifier ID or an inline modifier used to alter the item's properties. |
<source> | target selector | A player name, a UUID or a target selector such as @p, @a, @e or @s. |
<item> | item | An item ID, optionally followed by item components in brackets such as diamond_sword[enchantments={sharpness:5}]. |
<count> | whole number 1 to 99 | A whole number from 1 to 99 setting the stack size of the item. |
<target> | target selector | A player name, a UUID or a target selector such as @p, @a, @e or @s. |
/item replace entity @p weapon.mainhand with diamond_sword[enchantments={sharpness:5}]Places a Sharpness 5 diamond sword directly into the nearest player's main hand.
/item replace block 100 64 -200 container.0 with golden_apple 16Puts a stack of 16 golden apples into the first slot of the container at coordinates 100, 64, -200.
/item fill block ~ ~1 ~ container.1 with torch 64Fills slot 1 of the block directly above you with 64 torches.
/item override entity @a armor.head with carved_pumpkin 1Overrides the helmet slot of all players with a single carved pumpkin.
/item replace entity @s hotbar.0 from block ^ ^ ^2 container.5Copies the item from slot 5 of the container two blocks in front of you into your first hotbar slot.
/item fill entity @e[type=zombie,limit=1] weapon.offhand from entity @r hotbar.8Fills a single zombie's offhand slot with whatever item a random player has in their last hotbar slot.
/item override block ~-3 ~ ~ container.2 from entity @p enderchest.0Overrides slot 2 of a block three blocks west of you with the first item from the nearest player's Ender Chest.
Measured from the game files of every Java release from 1.13 to 26.3.
+ /item fill block <target> <slots> from block <source> <sourceSlots> [<modifier>]+ /item fill block <target> <slots> from entity <source> <sourceSlots> [<modifier>]+ /item fill block <target> <slots> with <item> [<count>]+ /item fill entity <target> <slots> from block <source> <sourceSlots> [<modifier>]+ /item fill entity <target> <slots> from entity <source> <sourceSlots> [<modifier>]+ /item fill entity <target> <slots> with <item> [<count>]− /item modify block <pos> <slot> <modifier>− /item modify entity <targets> <slot> <modifier>− /item replace block <pos> <slot> from block <source> <sourceSlot> [<modifier>]− /item replace block <pos> <slot> from entity <source> <sourceSlot> [<modifier>]− /item replace block <pos> <slot> with <item> [<count>]− /item replace entity <targets> <slot> from block <source> <sourceSlot> [<modifier>]and 16 moreIn Minecraft Bedrock Edition, the /item command does not exist; instead, players use the /replaceitem command (for example, /replaceitem block <position: x y z> slot.container <slotId: int> <itemName: Item> or /replaceitem entity <target: target> <slotType: EntityEquipmentSlot> <slotId: int> <itemName: Item>).
The /item command was added to Minecraft Java Edition in version 1.17.
In version 26.3, the syntax was updated to add /item fill and /item override forms, and arguments were updated to use slot sources like <slots> and <sourceSlots>.
You need permission level 2, which means you must be a server operator or have cheats turned on in a single-player world.