Skip to content
WikilyWIKILY
All games23 Wikis · pick your game
Commands and cheatsAll commands

Switch game

23 Wikis · pick your game
/item

Command

/item

Puts items into chosen inventory slots of entities or container blocks, copies items between slots, or changes the items already there.

Syntax

/item (fill|override|replace) (block <target>|entity <target>) <slots> from (block <source>|entity <source>) <sourceSlots> [<modifier>]
/item (fill|override|replace) (block <target>|entity <target>) <slots> with <item> [<count>]
/item modify (block <target>|entity <target>) <slots> <modifier>

Arguments

ArgumentKind of valueWhat to type
<target>Block positionWhere the items go: a block position after block, or one or more entities after entity.
<slots>Item slotsThe slots to change: a slot name such as weapon.mainhand, a group such as hotbar.*, or a slot source from a data pack or written inline.
<source>Block positionFor from: the block position or the entities the items are copied from.
<sourceSlots>Item slotsFor from: the slots the items are copied from, written like slots.
<modifier>Item modifierThe id of an item modifier from a data pack, or an item modifier written inline.
<item>ItemFor with: the item id, optionally followed by components in square brackets.
<count>Whole numberFor with: the size of the stack, from 1 to 99. Defaults to 1.

Details

Permission level2: operators, worlds with cheats on, command blocks and functions
Works inOperators on multiplayer servers, singleplayer worlds with cheats enabled, and command blocks and functions.
ResultReports "Replaced ... slot(s)" or "Modified ... slot(s)" with the entity or block position. The number /execute store saves is the number of slots that were changed.
replacePuts the given items into the chosen slots one after another and stops when the items run out. With a single item and several slots, only the first slot of each target receives it.
fillPuts the given items into every chosen slot, starting again from the first item when the items run out.
overridePuts the given items into the chosen slots one after another and empties the chosen slots that are left over.
modifyApplies an item modifier to the items in the chosen slots. Empty slots are skipped.
withUses a new item written in the command, with an optional count from 1 to 99.
fromCopies the items from slots of another block or of entities. An optional item modifier is applied to the copies before they are placed. The source keeps its items.
Slot namesSingle slots: contents, container.0 to container.53, hotbar.0 to hotbar.8, inventory.0 to inventory.26, enderchest.0 to enderchest.26, mob.inventory.0 to mob.inventory.7, horse.0 to horse.14, weapon, weapon.mainhand, weapon.offhand, armor.head, armor.chest, armor.legs, armor.feet, armor.body, saddle, horse.chest, player.cursor and player.crafting.0 to player.crafting.3. Whole groups: container.*, hotbar.*, inventory.*, enderchest.*, mob.inventory.*, horse.*, weapon.*, armor.* and player.crafting.*.
Blocks must be containersA block target or source must be a block with an inventory, such as a Chest. Otherwise the command fails with "is not a container".
Missing slotsFails with "The target does not have slot ..." if no target has the chosen slots, and with "The source does not have slot ..." if the source has none of them.
Nothing changedFails with "No targets accepted items into specified slots" if no slot was changed.

Examples

/item replace entity @s weapon.mainhand with minecraft:diamond_sword

Puts a Diamond Sword in your main hand, replacing what you hold.

/item replace block ~ ~-1 ~ container.0 with minecraft:diamond 16

Puts 16 Diamonds in the first slot of the container below you.

/item fill entity @s hotbar.* with minecraft:torch 64

Fills every slot of your hotbar with a stack of 64 Torches.

/item replace entity @s armor.head from entity @s weapon.mainhand

Puts a copy of the item you are holding on your head.

/item override block ~ ~-1 ~ container.* from entity @s hotbar.*

Copies your hotbar into the container below you and empties its remaining slots.

Join the creator communityThe people who build the Minecraft Java Edition wiki are on our Discord. Ask questions or suggest pages.Join Discord (opens Discord in a new tab)