Give, take, or clear items
edit_itemsModify items in player inventories, ender chests, or container blocks by giving, setting, taking, or clearing slots. Drops overflow for players and reports what was removed.
Instructions
Change what a player's inventory or ender chest holds (players:write; The player must be online; otherwise the error is player_offline.), or a chest, barrel, or other container block (world:write). Give either player (and container) or block. give adds an item where it fits: a player's overflow drops at their feet, a block's is lost and counted in dropped. set puts an item in a slot, replacing what was there. take removes amount items from a slot and says what it took. clear_slot empties one slot; clear empties everything, a player's armor and offhand included. Cleared and taken items are gone. Inventory slots: 0–8 hotbar, 9–35 main, 36 boots, 37 leggings, 38 chestplate, 39 helmet, 40 offhand. Ender chest slots: 0–26. A container's slots count from 0; a double chest has 54, the left half first.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| item | No | For give and set | |
| slot | No | For set, take, and clear_slot | |
| block | No | A container block instead of a player | |
| action | Yes | ||
| amount | No | For take: how many; the whole stack when left out | |
| player | No | Player name or UUID | |
| container | No | For a player | inventory |