/replaceitem Command in Minecraft Bedrock Edition

Replace Items in Block and Entity Inventories

Bedrock EditionItems & InventoryPermission: Game DirectorsCheats: YesJava version →

The /replaceitem command in Minecraft Bedrock Edition lets you place or swap items directly inside block inventories and entity equipment slots. You can choose the exact slot number, item count, data value, and extra JSON components.

Map makers and server operators use this command to equip mobs with gear, restock container blocks at specific coordinates, or lock items into a player's inventory. To run it, you must have cheats enabled and have the Game Directors permission level.

Syntax (4 forms)

  1. /replaceitem block <position: x y z> slot.container <slotId: int> <itemName: Item> [amount: int] [data: int] [components: json]

    Replace item

  2. /replaceitem entity <target: target> <slotType: EntityEquipmentSlot> <slotId: int> <itemName: Item> [amount: int] [data: int] [components: json]

    Replace entity

  3. /replaceitem block <position: x y z> slot.container <slotId: int> <oldItemHandling: ReplaceMode> <itemName: Item> [amount: int] [data: int] [components: json]

    Replace block, old item handling

  4. /replaceitem entity <target: target> <slotType: EntityEquipmentSlot> <slotId: int> <oldItemHandling: ReplaceMode> <itemName: Item> [amount: int] [data: int] [components: json]

    Replace entity, old item handling

Arguments

ArgumentTypeWhat it means
amountintAn optional integer that sets how many of the item to place in the slot, defaulting to 1.
componentsjsonAn optional JSON object that adds rules like minecraft:can_place_on, minecraft:can_destroy, minecraft:item_lock, or minecraft:keep_on_death.
dataintAn optional integer that sets the item data value, defaulting to 0.
itemNameItemThe name of the item to put into the block or entity slot.
oldItemHandlingReplaceModeSets how to handle existing items in the slot: use destroy to overwrite them or keep to leave existing items untouched.
position: x y zpositionThe X, Y, and Z coordinates of the container block you want to modify.
slotIdintAn integer that sets the exact slot number to modify, with a default value of 0.
slotTypeEntityEquipmentSlotThe equipment or inventory category on the entity that you want to modify.
targettargetThe player name or target selector that chooses which entity or player gets the item.

Examples

Tips

Common mistakes

Bedrock vs Java

In Minecraft Java Edition, this command has been replaced by the /item command, which uses forms like /item fill block <target> <slots> with <item> [<count>] or copies items directly between blocks and entities using from block and from entity.

See /item in Java Edition →

FAQ

How do I stop /replaceitem from deleting an item already in the slot?

Use the syntax form that includes the oldItemHandling argument and set it to keep instead of destroy so existing items are left alone.

Can I lock a replaced item so a player cannot move or drop it?

Yes, add the components JSON argument at the end of the command and include minecraft:item_lock after specifying the amount and data values.

What permissions do I need to use /replaceitem in Bedrock Edition?

Your world must have cheats turned on, and you need the Game Directors permission level to execute the command.

Related commands

/clear/enchant/give/loot/recipe