Class PrivItem
-
Method Summary
Modifier and TypeMethodDescriptionbooleandrink()Drinks this inventory item using itsDrinkmenu option.booleaneat()Eats this inventory item using itsEatmenu option.booleanexists()True if this slot still holds the same item id and quantity in the live container snapshot from the client.intAlias forgetQuantity().The container this row came from.intgetId()The item id in this slot as captured by the snapshot.intgetItem()Item id (for bank/equipment/inventory); same asgetId().getName()Resolves this item's display name viaItemManager.intThe stack size in this slot as captured by the snapshot.intgetSlot()The 0-based slot index in its container.booleanWhether the item definition listsaction(exact, case-insensitive) among its inventory options.booleanDispatchesactionon this slot, marshalled throughGameThread.ensure(java.util.function.Supplier<T>, T).booleanisNoted()True when the item definition marks this id as a bank note.
-
Method Details
-
getContainerKind
The container this row came from. -
getId
public int getId()The item id in this slot as captured by the snapshot. -
getQuantity
public int getQuantity()The stack size in this slot as captured by the snapshot. -
getAmount
public int getAmount()Alias forgetQuantity(). -
getItem
public int getItem()Item id (for bank/equipment/inventory); same asgetId(). -
getSlot
public int getSlot()The 0-based slot index in its container. -
getName
Resolves this item's display name viaItemManager.itemManager.getItemComposition(...)is a RuneLite client-thread API, andctx.inventory.*runs on a script/worker thread — so this must marshal throughGameThread.ensure(java.util.function.Supplier<T>, T)exactly likeinteract(String)does. Previously it called the API straight from the caller's thread inside acatch (Throwable ignored), which turned an off-thread failure into a plausible-looking wrong answer: confirmed live on Elorin where the item IS found (RESOLVED Inventory via direct-array widget (Strategy 0) -> 3214: 1 items) and the definition DOES resolve (ItemDefDiag id=385 resolved=true ... accessorName(ItemComp)=Shark), yet the name came back"item:385"— silently breaking every name-based verb (has,contains,count,outOf,first,eat,drink,wield,drop,use, ...) becauseItemQuery.withNamedoes"item:385".contains("shark")-> false.When
ItemManageryields nothing usable — including when it isnull, which is the normal case on Impact, Elorin and SpawnPK — this falls back to the client's item-name lookup, the same client-native definition-table route that the diagnostic above proved resolvesSharkcorrectly. Only if BOTH paths come back empty does this degrade to the"item:<id>"placeholder. -
isNoted
public boolean isNoted()True when the item definition marks this id as a bank note. False when it cannot tell: with noItemManager(Impact, Elorin, SpawnPK) this is always false. The lookup is not marshalled. -
exists
public boolean exists()True if this slot still holds the same item id and quantity in the live container snapshot from the client. Bank items return false when the bank is closed. -
hasAction
Whether the item definition listsaction(exact, case-insensitive) among its inventory options. False when the definition cannot be read, which is not proof the option is missing. -
interact
Dispatchesactionon this slot, marshalled throughGameThread.ensure(java.util.function.Supplier<T>, T). The slot index and id come from the snapshot, so act on a fresh query.- Parameters:
action- case-insensitive action label (e.g. Eat, Drop, Wear, Withdraw-1, Remove)- Returns:
- true when the action was dispatched, not proof it happened: confirm the change (count, worn item, hitpoints) with a later read. False when the action cannot be resolved for this item or container, or the marshalled call was dropped.
-
eat
public boolean eat()Eats this inventory item using itsEatmenu option. -
drink
public boolean drink()Drinks this inventory item using itsDrinkmenu option.
-