Skip to content
/SLASHPLAY

How to replace an item in a slot in Minecraft

Type /item replace entity @p armor.head with minecraft:diamond_helmet in chat as an operator to put a diamond helmet in your head slot.

item

Replaces or modifies items in specific slots of players, mobs or containers.

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

Examples

/item replace entity @p armor.head with minecraft:diamond_helmet

Puts a diamond helmet on the nearest player.

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

Fills the first slot of the chest below you.

/item modify entity @p weapon.mainhand mypack:add_sharpness

Runs a data pack item modifier on the held item.

Arguments

block|entityRequired
A container block position, or entities.
slotRequired
Slot name, such as armor.head, weapon.offhand or container.5.
itemOptional
Item ID after with, with an optional count up to 99.
modifierOptional
Item modifier ID, for modify.

What it does

item replace puts an item (or a copy from another slot) into a slot such as armor.head, weapon.mainhand or container.0. item modify runs an item modifier from a data pack on the item in a slot, for example to add enchantments or change its count. Version 26.3 also has fill and override forms that take the same slot and item arguments.

Good to know

  • Needs operator permission level 2.
  • Replacing a slot overwrites whatever was there.

Run it on your server

On a SLASHPLAY server, type it in the Console tab without the leading slash; in game, operators type it in chat with the slash. New to this? Start a Minecraft server first.

Your own
Minecraft server.

From $0.03 an hour, only while it runs. New accounts get 6 free tokens.