All commands
๐ŸŽ’
AdvancedJava โœ“Bedrock -

/item

Replace or modify the item in a specific inventory or equipment slot.

๐ŸชจThis command is Java Edition only - Bedrock has no direct equivalent.

Overview

What is the /item command?

The /item command modifies or replaces items in inventory or equipment slots, and can apply loot tables and item modifiers. It's the modern, flexible successor to /replaceitem, able to copy items between slots and transform them with datapack modifiers.

It's used for precise inventory setups, equipping mobs, and advanced datapack item manipulation.

When to use it: Use /item to set, replace or modify items in specific inventory or armor slots โ€” including on mobs.

At a glance

Syntax

Syntax
/item replace <target> <slot> with <item>
commandtargetcoordsvaluerequiredoptional

See it

What it does

๐Ÿชต๐Ÿ’Ž
weapon.mainhand
Swapping the item in a slot

Anatomy

Every part, explained

  1. 1
    /item replaceCommandRequired

    Swaps the item in a slot. Also has 'modify'.

  2. 2
    <target>TargetRequired

    Who or what gets the item, e.g. entity @s.

  3. 3
    <slot>SlotRequired

    The slot to fill, e.g. weapon.mainhand.

  4. 4
    with <item>ItemRequired

    The item to place, e.g. diamond_sword.

Your turn

Try it yourself

Playground
7 tokens ยท press Enter to run

Copy & paste

Examples

/item replace entity @s weapon.mainhand with diamond_sword

Put a sword in your main hand.

/item replace entity @s armor.head with diamond_helmet

Equip a diamond helmet.

/item replace entity @s hotbar.0 with golden_apple 16

Fill the first hotbar slot with 16 golden apples.

Avoid these

Common mistakes

โœ•/item replace @s weapon.mainhand with stick
โœ“/item replace entity @s weapon.mainhand with stick

Say 'entity' or 'block' before the target.

โœ•/item replace entity @s mainhand with stick
โœ“/item replace entity @s weapon.mainhand with stick

Hand slots are weapon.mainhand and weapon.offhand.

Good to know

Frequently asked questions

How do you put an item in a specific slot?
Run /item replace entity @s <slot> with <item>, e.g. /item replace entity @s weapon.mainhand with diamond_sword.
How do you equip armor on a mob with a command?
Target the mob's armor slot, e.g. /item replace entity @e[type=zombie,limit=1] armor.head with diamond_helmet.
What replaced the /replaceitem command?
/item replace does everything /replaceitem did, plus copying and modifying items, so /replaceitem was retired in favour of it.

Keep going

Related commands