|Syntax||- inventory [open/close/copy/move/swap/set/keep/exclude/fill/clear/update/adjust <mechanism>:<value>/flag <name>(:<action>)[:<value>] (duration:<duration>)] (destination:<inventory>) (origin:<inventory>/<item>|...) (slot:<slot>)|
|Short Description||Edits the inventory of a player, NPC, or chest.|
|Full Description||Use this command to edit the state of inventories.
By default, the destination inventory is the current attached player's inventory.
If you are copying, swapping, removing from (including via "keep" and "exclude"), adding to, moving, or filling inventories,
you'll need both destination and origin inventories.
Origin inventories may be specified as a list of ItemTags, but destinations must be actual InventoryTags.
Using "open", "clear", or "update" only require a destination.
"Update" also requires the destination to be a valid player inventory.
Using "close" closes any inventory that the currently attached player has opened.
The "adjust" option adjusts mechanisms on an item within a specific slot of an inventory (the "slot" parameter is required).
Note that this is only for items, it does NOT adjust the inventory itself. Use command/adjust to adjust an inventory mechanism.
The "flag" option sets a flag on items, similar to command/flag.
See also language/flag system.
Note that to add items to an inventory, you should usually use command/give,
and to remove items from an inventory, you should usually use command/take.
The slot argument can be any valid slot, see language/Slot Inputs.
» Use to open a chest inventory, at a location.
- inventory open d:<context.location>
» Use to open a virtual inventory with a title and some items.
- inventory open d:generic[size=27;title=BestInventory;contents=snow_ball|stick]
» Use to open another player's inventory.
- inventory open d:<[player].inventory>
» Use to remove all items from a chest, except any items in the specified list.
- inventory keep d:<context.location.inventory> o:snow_ball|ItemScript
» Use to remove all sticks and stones from the player's inventory.
- inventory exclude origin:stick|stone
» Use to swap two players' inventories.
- inventory swap d:<[playerOne].inventory> o:<[playerTwo].inventory>
» Use to adjust a specific item in the player's inventory.
- inventory adjust slot:5 "lore:Item modified!"
» Use to set a single stick into slot 10 of the player's inventory.
- inventory set o:stick slot:10
» Use to set a temporary flag on the player's held item.
- inventory flag slot:<player.held_item_slot> my_target:<player.cursor_on> duration:1d