This repository was archived by the owner on May 10, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
API Inventory
Legends11 edited this page Apr 18, 2026
·
1 revision
← Home
| Function | Input | Description |
|---|---|---|
inv/selected_item |
{item, customData, invoke} |
Run invoke for all players holding matching item in mainhand |
inv/offhand_item |
{item, customData, invoke} |
Run invoke for all players holding matching item in offhand |
inv/player_if_item |
{player, item, customData, invoke} |
Run invoke if specific player holds item in mainhand |
inv/player_unless_item |
{player, item, customData, invoke} |
Run invoke if specific player does NOT hold item |
inv/player_slot_if_item |
{player, slot, item, customData, invoke} |
Run invoke if specific slot contains item |
inv/chest_minecart_if_item |
{item, customData, invoke} |
Run invoke for chests/minecarts containing item |
inv/chest_minecart_unless_item |
{item, customData, invoke} |
Run invoke for containers NOT containing item |
inv/cursor_item |
— | Read cursor item (held in GUI) to macro:output
|
| Field | Type | Description |
|---|---|---|
item |
string | Item ID, e.g. "minecraft:diamond_sword"
|
customData |
compound |
minecraft:custom_data NBT to match (optional) |
invoke |
string | Function path to call on match |
data modify storage macro:input item set value "minecraft:carrot_on_a_stick"
data modify storage macro:input customData set value {mypack_tag:"my_wand"}
data modify storage macro:input invoke set value "mypack:wand/on_hold"
function macro:player/inv/selected_item with storage macro:input {}# Check if Steve has a diamond in slot 0 (first hotbar slot)
data modify storage macro:input player set value "Steve"
data modify storage macro:input slot set value 0
data modify storage macro:input item set value "minecraft:diamond"
data modify storage macro:input customData set value {}
data modify storage macro:input invoke set value "mypack:diamond/found"
function macro:player/inv/player_slot_if_item with storage macro:input {}# Run function for each chest containing a beacon
data modify storage macro:input item set value "minecraft:beacon"
data modify storage macro:input customData set value {}
data modify storage macro:input invoke set value "mypack:chest/found_beacon"
function macro:player/inv/chest_minecart_if_item with storage macro:input {}-
customDatausesminecraft:custom_datacomponent matching (1.21.x+). Pass{}to match any item of the given type regardless of custom data. -
invoke(previouslyaction/callbackin older versions) — always useinvokein v2.0.3+. -
inv/cursor_itemreads from the player's GUI cursor slot and writes tomacro:output. Useful in combination withinteraction/for custom UIs.