Inventory Replace Generator
Target
Item
About the item replacement generator
Replacing an item in a specific slot is how you equip a mob with armour, place a weapon in an entity's hand, or set the exact contents of a container. It gives slot-level control that /give cannot offer, because /give only ever appends to the first free space.
How to use this generator
Identify the target entity or block position, name the slot to write into, and define the item that should end up there. On modern versions this is expressed through /item replace rather than the retired /replaceitem command.
Things worth knowing
- Equipping armour on a mob through the armor.head through armor.feet slots is the standard way to build themed mobs.
- Writing to a slot that does not exist for that target fails with an error rather than doing nothing.
- Mobs given equipment this way can still drop it on death unless drop chances are set to zero.
- For containers, the block must already be placed before its slots can be written to.
The generated command is produced entirely in your browser and nothing you enter is sent to EloTiers. Paste the result into the chat bar or a command block in your own world. If a command is rejected, check that the Minecraft version selected here matches the version you are actually running — the item and entity data format changed substantially in 1.20.5.
Worked examples
Equip the nearest zombie
/item replace entity @e[type=minecraft:zombie,limit=1,sort=nearest] armor.head with minecraft:diamond_helmetThe selector picks the closest zombie and puts a diamond helmet on its head. Useful for themed encounters.
Give yourself an off-hand shield
/item replace entity @p weapon.offhand with minecraft:shieldWrites the shield straight into the off-hand slot of the nearest player.
Stock a chest slot
/item replace block ~ ~ ~ container.13 with minecraft:diamond 3Slot 13 is the middle slot of a single chest. The chest has to exist at that position already.
Frequently asked questions
Why does the mob drop the armour I gave it?
Equipment given with a command can drop when the mob dies. To stop that, set the drop chance for that equipment slot to zero in the mob's data when you summon it.
Which slots can I write to on a player?
Players have hotbar.0 to hotbar.8, inventory.0 to inventory.26, the armour slots, weapon.mainhand and weapon.offhand, and a few more for the ender chest and crafting grid.
What replaced the old /replaceitem command?
/item replace. The syntax changed in Minecraft 1.17, and this generator emits the current form.