Skip to content

Inventory actions

Equip, eat, drink potions, drop, craft, and drive chests and server menus.

Seventeen actions covering the client's own inventory and any window it opens: a chest, a furnace, or a plugin shop GUI.

Two rules run through this whole page.

Every block that names an item has a dropdown next to it deciding how the name is matched:

DropdownMatchesField value
by name (default)The registry id, e.g. diamond_swordname
by display nameA custom, anvil-renamed namedisplay_name
by loreText inside the item's lore lineslore

A registry name matches exactly when such an item exists: stone is stone and never cobblestone, stick is never a sticky piston, diamond is never a diamond sword. Text that is not a registry name matches every item whose name contains it, so sword takes any sword and _log any log. Blocks and mobs are matched the same way, in dig nearest, attack and the other blocks that name one. Player names always match exactly. Display name and lore match any text they contain.

And every container block except open container needs a window already open. Without one they fail. A failure is visible to try and to the last_action_failed condition, which is how you check instead of guessing.

equip

Puts an item into a hand or an armour slot.

FieldTypeRequiredNotes
itemstring, 1–64 charsyesWhat to equip.
matchByname | display_name | lorenoDefault name.
tohand | off-hand | head | torso | legs | feetnoDefault hand.
equip diamond_pickaxe by name to hand

Fails when no item matches, or when the item cannot be worn in that armour slot (a sword on head). When several items match, it takes one that fits the slot.

eat

Eats food and puts the previously held item back.

FieldTypeRequiredNotes
itemstring, 1–64 charsnoEat this food. Leave out to pick the best safe food in the inventory.
matchByname | display_name | lorenoDefault name.
eat by name

Best safe food is the one that restores the most hunger. It never picks rotten flesh, spider eyes, poisonous potatoes, pufferfish, chorus fruit or suspicious stew unless you name it in item. Fails when no matching food is in the inventory. When the client is full, the step is done and counts as a success, except for golden apples, which can always be eaten. So eat after a heal is safe: it tops food up and otherwise does nothing.

use_potion

Drinks a potion, or throws a splash potion at its own feet.

FieldTypeRequiredNotes
effecthealing | regeneration | strength | swiftness | fire_resistancenoDefault healing. Strong and long variants count.
use healing potion

A drinkable potion is preferred, and the step waits until it is drunk, so several use_potion steps in a row each drink one. If there is only a splash potion, the client turns to look straight down, throws it at its feet and looks level again. Lingering potions are ignored. The previously held item goes back in the hand, in the hotbar slot it came from. Fails when no matching potion is in the inventory, or when the drink did not happen. It works the same on every supported game version, old potion data included.

equip_best

Puts the best weapon in hand and the best armour on.

FieldTypeRequiredNotes
whatweapon | armor | bothnoDefault both.
equip best weapon and armour

A weapon is ranked by material, netherite then diamond then iron, then stone and gold together, then wood, with a sword ahead of an axe at the same tier and a trident after a diamond sword. Armour is ranked per slot, netherite, diamond, iron, chainmail, gold, leather. A turtle shell counts as iron for the head, and an elytra in the chest slot is left alone. Enchantments are ignored. When nothing beats what is worn, the step succeeds and changes nothing. This is its own action rather than a special item name on equip, so that action keeps meaning one item.

A good use is the item_collected trigger, to put on a better sword a mob just dropped. Do not do that in a fishing flow: see fish.

drop

Throws some of one item on the ground.

FieldTypeRequiredNotes
itemstring, 1–200 charsyesWhat to drop. Several, separated by commas or semicolons, match any of them (name matching only).
matchByname | display_name | lorenoDefault name.
countinteger, 1–64noOmitted drops the whole stack.
toPlayerplayer namenoFaces that player first, so the items land near them.
drop cobblestone by name x 64 to player

The editor has one Drop block covering both this and drop_all; which one it writes depends on whether you asked for everything.

drop_all

Throws away every matching stack, or the entire inventory.

FieldTypeRequiredNotes
itemstring, 1–200 charsnoOmitted drops everything the client carries. Several, separated by commas or semicolons, match any of them (name matching only).
matchByname | display_name | lorenoDefault name.
drop dirt by name x 0 to player — all of it ☑

select_slot

Selects a hotbar slot.

FieldTypeRequiredNotes
slotinteger, 0–8yesHotbar index, left to right.
select hotbar slot 0

A variable that holds anything else fails the step; the rest of the trigger still runs.

craft

Crafts an item by registry name.

FieldTypeRequiredNotes
itemstring, 1–64 charsyesWhat to craft.
countinteger, 1–64noDefault 1. How many times to craft, not how many items: stick x 4 makes 16 sticks.
craft stick x 16

The crafts run one at a time. When the materials run out part way, the crafts already made are kept and the step fails.

Recipes needing a 3×3 grid use a crafting table within 16 blocks, and the client walks to it first. Without one, only 2×2 recipes work. Planks of different woods mix in one recipe, the way they do for a player. To have the client work out a whole recipe chain from the base chests, use obtain.

container_open

Opens a container and holds the window for the actions that follow.

FieldTypeRequiredNotes
modelooking | coords | nearestnoOmitted keeps the original rule: coordinates if given, otherwise the block being looked at.
x, y, zintegersfor coordsWhich block to open.
radiusinteger, 1–32noDefault 6. Search radius for nearest.
open container nearest container x y z · radius 6

mode: nearest is usually what you want for a client parked beside a chest whose exact coordinates you do not know. It prefers a chest, barrel, shulker box, hopper, dispenser or dropper over a closer furnace, smoker, blast furnace or brewing stand, and opens one of those only when no storage container is in range.

Chests of every kind (copper chests included), barrels, shulker boxes, hoppers, dispensers, droppers, furnaces, smokers, blast furnaces and brewing stands all open as a window that the container actions below work on. The container must be within reach, 4.5 blocks, like a player; the step fails at once when it is further, or when the block is not a container.

Blocks until a server menu window opens, and latches it for the clicks that follow.

FieldTypeRequiredNotes
timeoutMsinteger, 250–30000noDefault 3000.
when run manually or by webhook
command /shop
wait for shop menu (up to 5 seconds)
click menu item diamond by name left

A menu that is already open counts, so the step returns at once. After a click in the menu it waits for the next window replacing the current one (a buy screen followed by a confirm screen), so a multi-step menu can be walked one menu_wait at a time. The step fails when no menu opens before the timeout.

container_click

Clicks a raw slot in the open window, by index.

FieldTypeRequiredNotes
slotinteger, 0–255yesSlot index, numbered as the game numbers them: the container's own slots first, then the player inventory section.
buttonleft | rightnoDefault left.
modenormal | shiftnoDefault normal. shift is a shift-click.
click slot 13 button left shift

Slot indexes break when a server rearranges its GUI. Prefer menu_click, which finds the item instead of trusting a position.

Clicks the first slot in the open window whose item matches, wherever it sits.

FieldTypeRequiredNotes
itemstring, 1–64 charsyesWhat to look for.
matchByname | display_name | lorenoDefault name.
buttonleft | rightnoDefault left.
click menu item Buy 64 by display name left

Plugin shops label their buttons with display names and lore, so display_name and lore matching is what makes a shop flow survive a layout change.

container_withdraw

Moves items out of the open container and into the inventory.

FieldTypeRequiredNotes
itemstring, 1–200 charsyesWhat to take. Several, separated by commas or semicolons, match any of them (name matching only).
matchByname | display_name | lorenoDefault name.
countinteger, 1–2304noOmitted takes everything matching.
take cooked_beef by name x 32 from container

container_deposit

Moves items from the inventory into the open container.

FieldTypeRequiredNotes
itemstring, 1–200 charsyesWhat to put in. Several, separated by commas or semicolons, match any of them (name matching only).
matchByname | display_name | lorenoDefault name.
countinteger, 1–2304noOmitted deposits everything matching.
put iron_ore by name x 64 into container

container_deposit_all

Empties the inventory into the open container: every matching stack, or all of it.

FieldTypeRequiredNotes
itemstring, 1–200 charsnoOmitted deposits the whole inventory. Several, separated by commas or semicolons, match any of them (name matching only).
matchByname | display_name | lorenoDefault name.
on inventory full
open container nearest container x y z · radius 8
put by name x 0 into container — all of it ☑
close container

A blank item with all of it ticked means the whole inventory; typing a list deposits several materials in one step:

put prismarine_shard, disc_fragment_5 by name x 0 into container — all of it ☑

The "empty me into this chest" step of every farm loop.

container_withdraw_all

Pulls the open container empty: every matching stack, or everything in it.

FieldTypeRequiredNotes
itemstring, 1–200 charsnoOmitted takes everything. Several, separated by commas or semicolons, match any of them (name matching only).
matchByname | display_name | lorenoDefault name.
take wheat by name x 0 from container — all of it ☑

container_close

Closes the open window.

No fields.

close container

Close what you open. A window left open blocks the next container_open, and window_closed is how another trigger learns it went away.

Inventory actions · CubeMind docs