← Back to Command Directory ← Back to Home

/item

Manipulates items in the inventories of blocks (chests, hoppers, etc.) or entities (players, mobs). Replaces the removed /replaceitem command with expanded functionality including item modifiers.

Syntax

/item replace block <pos> <slot> with <item> [<count>]
/item replace entity <targets> <slot> with <item> [<count>]
/item replace block <pos> <slot> from block <source pos> <source slot> [<modifier>]
/item replace entity <targets> <slot> from entity <source> <source slot> [<modifier>]
/item modify block <pos> <slot> <modifier>
/item modify entity <targets> <slot> <modifier>

Parameters

NameRequiredDescription
posYesCoordinates of the target block entity.
targetsYesThe target entity/entities.
slotYesThe inventory slot (e.g., container.0, weapon.mainhand, armor.head).
itemYes (replace with)The item identifier to place in the slot.
countNoNumber of items (defaults to 1).
modifierNo / Yes (modify)An item modifier defined in a data pack that transforms the item.
source pos / sourceYes (replace from)The block or entity to copy an item from.
source slotYes (replace from)The slot to copy from.

Examples

/item replace entity @p weapon.mainhand with minecraft:diamond_sword
/item replace block ~ ~-1 ~ container.0 with minecraft:redstone 64
/item replace entity @p armor.head from entity @e[type=zombie,limit=1] armor.head
/item modify entity @p weapon.mainhand my_pack:enchant_sharpness

Notes

Related Commands