/replaceitem
Command
Replaces items in inventories.
Permission Level | Game Directors |
---|---|
Requires Cheats? | Yes |
Usage
Replace item
/replaceitem block <position: x y z> slot.container <slotId: int> <itemName: Item> [amount: int] [data: int] [components: json]
Replace an item
at a required position
into the slot with type slot id
, item name
, amount
, data
, and components
.
Replace entity
/replaceitem entity <target: target> <slotType: EntityEquipmentSlot> <slotId: int> <itemName: Item> [amount: int] [data: int] [components: json]
Replace item on an entity
target
into the slot with type slot id
or slot type
, item name
, with optional amount
, data
, and components
.
Replace block, old item handling
/replaceitem block <position: x y z> slot.container <slotId: int> <oldItemHandling: ReplaceMode> <itemName: Item> [amount: int] [data: int] [components: json]
Replace item
at a required position
into the slot with type slot id
, using old item handling to replace with an item name
, amount
, data
, and components
.
Replace entity, old item handling
/replaceitem entity <target: target> <slotType: EntityEquipmentSlot> <slotId: int> <oldItemHandling: ReplaceMode> <itemName: Item> [amount: int] [data: int] [components: json]
Replace an entity
with required target
, into the slot with type slot id
or slot type
, item name
, using old item handling
to replace with optional amount
, data
, and components
.
Arguments
amount
: int Aninteger
to specify the number of items to place in inventory. Default:1
.components
: json AJSON
object that supportsminecraft:can_place_on
,minecraft:can_destroy
,minecraft:item_lock
, andminecraft:keep_on_death
. Default:false
.data
: int Aninteger
that specifies the item data for the items in the inventory. Default:0
.itemName
: Item Specifies the item to be placed in the entity or block inventory slot.oldItemHandling
: ReplaceMode Eitherdestroy
to replace items in slot orkeep
to keep items instead of replacing them.position: x y z
: positionVector
[x y z] of the position of the block to modify.slotId
: int Aninteger
that sets the slot to be modified. Default:0
.slotType
: EntityEquipmentSlot Entity equipment slottarget
: target Specifies the entity to modify, either a player name or a target selector.
Enums
ReplaceMode
Enum of Replace Modes
Values
destroy
Destroykeep
Keep
Feedback
https://aka.ms/ContentUserFeedback.
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see:Submit and view feedback for