Commands/replaceitem

Replaces items in the inventories of blocks (chest, furnaces, etc.) or entities (players or mobs) with the given item(s).

Arguments

 * Specifies the position of the block to be modified.


 * Specifies one or more entities to modify.

,  and
 * Specifies the inventory slot to be modified. Valid values depend on whether a block or an entity is being modified. See Slot for details.
 * And it must be between -2147483648 and 2147483647 (inclusive).


 * Specifies the item to be placed in the block or entity's inventory slot.


 * Specifies the number of items to be placed in the block or entity's inventory slot.
 * And it should be between 1 and 64 (inclusive).


 * Specifies the item data for the item(s) to be placed in the block or entity's inventory slot. Values which are invalid for the specified item id will default to 0. If not specified, defaults to 0.
 * It must be between -2147483648 and 2147483647 (inclusive).


 * Specifies the item components. Like data tags but supports only,  ,  , and   functions (see Commands/give)


 * Must be one of:
 * - Directly replaces items ignoring the original items in the specified slot.
 * - Does not replace items if an item occupies that slot.

Examples

 * To replace the items in the bottom-right slot of a single chest two block above with four spruce saplings:
 * To replace the items in the rightmost hotbar slot of the nearest player with four spruce saplings:
 * To replace the items in the rightmost hotbar slot of the nearest player with four spruce saplings: