Use-Item and Bank-Inventory Actions
Two action classes cover "use this on that." UseItemActions combines an inventory item with another item, an NPC, an object, a ground item, a player, or a widget. BankInventoryActions interacts with inventory slots while the bank is open. Both live under com.n3plugins.InteractionApi.actions, return InteractionResult, and route through ActionPacer.
UseItemActions
UseItemActions.itemOnItem("Pestle and mortar", "Blue dragon scale");
UseItemActions.itemOnObject("Raw shrimps", "Fire");
UseItemActions.itemOnNpc(ItemID.BUCKET_OF_MILK, "Cow");
UseItemActions.dragAndDrop(sourceWidget, destWidget);
| Method | Combines |
|---|---|
itemOnItem(String sourceName, String targetName) | two inventory items by name |
itemOnItem(int sourceItemId, int targetItemId) | two inventory items by id |
itemOnNpc(int sourceItemId, String npcName) | item on the nearest matching NPC |
itemOnNpc(int sourceItemId, NPC npc) | item on the specific NPC instance you pass |
itemOnObject(String sourceName, String objectName) | item on the nearest matching object (by item name) |
itemOnObject(int sourceItemId, String objectName) | item on the nearest matching object (by item id) |
itemOnObject(int sourceItemId, TileObject object) | item on the specific object instance you pass |
itemOnTileItem(int sourceItemId, int tileItemId) | item on a ground item |
itemOnPlayer(int itemId, String playerName) | item on the nearest matching player |
itemOnPlayer(int itemId, Player player) | item on the player you pass |
widgetOnWidget(Widget source, Widget target) | one widget on another |
dragAndDrop(Widget src, Widget dest) | drag a widget onto a destination slot |
The direct NPC and TileObject overloads are useful when a caller already resolved the exact world target and wants to avoid a second name-based lookup.
A direct combine never opens a production interface. For the make-X menu (fletching, smelting, crafting), use ProductionWorkflowBuilder instead (see production-workflow.md).
BankInventoryActions
While the bank is open, the inventory renders in a separate bank-side container. BankInventoryActions interacts with those slots: deposit a single item, use an item on the bank, or trigger a slot's menu action.
BankInventoryActions.use("Lobster", "Deposit-1");
BankInventoryActions.use(ItemID.LOBSTER, "Deposit-all");
BankInventoryActions.useIndex(0, "Deposit-all");
| Method | Targets |
|---|---|
use(String name, String... actions) | first bank-inventory slot matching the name |
use(int id, String... actions) | first bank-inventory slot with that id |
use(Predicate<? super Widget> predicate, String... actions) | first slot matching the test |
useIndex(int index, String... actions) | the raw 1-based menu index on the matched slot |
use(Widget item, String... actions) | the slot widget you pass |
For full-deposit and withdraw flows against a target inventory, use BankActions or BankWorkflowBuilder with a loadout (see banking.md).
Pacing
Both classes check ActionPacer.isReady(...) and return InteractionStatus.PACED when the gate is closed. A caller that retries each tick lands the action once the pacer clears.