Package net.storm.api.domain
Interface Interactable
- All Known Subinterfaces:
IActor,IBankInventoryItem,IBankItem,IDecorativeObject,IGameObject,IGroundObject,IInventoryItem,IItem,INPC,IPlayer,ITileItem,ITileObject,IWallObject,IWidget,SceneEntity,TileEntity
public interface Interactable
Represents an entity that can be interacted with via the game's menu system.
Interactable entities have right-click menu actions (e.g., "Attack", "Talk-to", "Pick up", "Open"). This interface provides methods to:
- Check if an entity can be interacted with
- Query available actions
- Perform interactions
Example usage:
// Interact with first action
npc.interact();
// Interact with specific action
npc.interact("Talk-to");
// Interact with any of multiple actions
object.interact("Open", "Enter");
// Check if interaction is possible
if (object.isInteractable() && object.hasAction("Open")) {
object.interact("Open");
}
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptiondefault AutomatedMenugenerateMenu(int actionIndex) Generates a menu entry for the specified action index using default interaction.default AutomatedMenugenerateMenu(String action) Generates a menu entry for a named action using default interaction.default AutomatedMenugenerateMenu(net.runelite.api.MenuAction opcode) Generates a menu entry for a specific opcode using default interaction.default AutomatedMenugenerateMenu(IInventoryItem item) Generates a menu entry for using an item using default interaction.generateMenu(InteractMethod interactMethod, int actionIndex) Generates a menu entry for interacting with this entity.default AutomatedMenugenerateMenu(InteractMethod interactMethod, String action) Generates a menu entry for a named action using a specific interaction method.generateMenu(InteractMethod interactMethod, net.runelite.api.MenuAction opcode) Generates a menu entry for interacting with this entity using a specific opcode.generateMenu(InteractMethod interactMethod, IInventoryItem item) Generates a menu entry for using an item on this entity.generateMenu(InteractMethod interactMethod, Spell spell) Generates a menu entry for casting a spell on this entity.default AutomatedMenugenerateMenu(Spell spell) Generates a menu entry for casting a spell using default interaction.default intgetActionIndex(String action) Gets the index of a specific action in the actions array.String[]Gets the available right-click menu actions for this entity.Gets a suitable click point on this entity for mouse interaction.default booleanChecks if this entity has any non-empty actions.default booleanChecks if this entity has any of the specified actions.default booleanChecks if this entity has an action matching the given filter.default voidinteract()Interacts with the first (default) action on this entity.default voidinteract(int index) Interacts with this entity using a specific action index and default interaction.default voidInteracts with a named action using default interaction.default voidInteracts with the first matching action from multiple options using default interaction.default voidInteracts with the first action matching a predicate using default interaction.default voidinteract(net.runelite.api.MenuAction opcode) Interacts with this entity using a specific opcode and default interaction.default voidinteract(IInventoryItem item) Uses an inventory item on this entity using default interaction.voidinteract(AutomatedMenu automatedMenu) Performs an interaction using a pre-built menu entry.default voidinteract(InteractMethod interactMethod, int index) Interacts with this entity using a specific action index and interaction method.default voidinteract(InteractMethod interactMethod, String action) Interacts with a named action using a specific interaction method.default voidinteract(InteractMethod interactMethod, String... actions) Interacts with the first matching action from multiple options.default voidinteract(InteractMethod interactMethod, Predicate<String> predicate) Interacts with the first action matching a predicate.default voidinteract(InteractMethod interactMethod, net.runelite.api.MenuAction opcode) Interacts with this entity using a specific opcode and interaction method.default voidinteract(InteractMethod interactMethod, IInventoryItem item) Uses an inventory item on this entity.default voidinteract(InteractMethod interactMethod, Spell spell) Casts a spell on this entity.default voidCasts a spell on this entity using default interaction.booleanChecks if this entity can be interacted with from the local player's position.booleanisInteractable(net.runelite.api.coords.WorldPoint from) Checks if this entity can be interacted with from a specific position.default booleanisInteractable(Locatable from) Checks if this entity can be interacted with from another entity's position.
-
Method Details
-
isInteractable
boolean isInteractable()Checks if this entity can be interacted with from the local player's position.This considers line of sight, distance, and whether the entity is reachable.
- Returns:
- true if the entity can be interacted with
-
isInteractable
boolean isInteractable(net.runelite.api.coords.WorldPoint from) Checks if this entity can be interacted with from a specific position.- Parameters:
from- the position to check interaction from- Returns:
- true if the entity can be interacted with from that position
-
isInteractable
Checks if this entity can be interacted with from another entity's position.- Parameters:
from- the entity to check interaction from- Returns:
- true if the entity can be interacted with from that position
-
getActions
Gets the available right-click menu actions for this entity.Actions are indexed 0-4 for standard actions. The array may contain null entries for unavailable action slots.
- Returns:
- array of action names, or null if no actions available
-
getClickPoint
Coordinate getClickPoint()Gets a suitable click point on this entity for mouse interaction.- Returns:
- the click point coordinates
-
getActionIndex
Gets the index of a specific action in the actions array.- Parameters:
action- the action name to find- Returns:
- the action index (0-4), or -1 if not found
-
hasAction
Checks if this entity has an action matching the given filter.- Parameters:
filter- the predicate to test actions against- Returns:
- true if any action matches the filter
-
hasAction
Checks if this entity has any of the specified actions.- Parameters:
actions- the action names to check for- Returns:
- true if any of the actions exist
-
hasAction
default boolean hasAction()Checks if this entity has any non-empty actions.- Returns:
- true if at least one action exists
-
generateMenu
Generates a menu entry for interacting with this entity.- Parameters:
interactMethod- the interaction method to use (null for default)actionIndex- the action index (0-4)- Returns:
- the generated menu entry
-
generateMenu
Generates a menu entry for interacting with this entity using a specific opcode.- Parameters:
interactMethod- the interaction method to use (null for default)opcode- the menu action opcode- Returns:
- the generated menu entry
-
generateMenu
Generates a menu entry for casting a spell on this entity.- Parameters:
interactMethod- the interaction method to use (null for default)spell- the spell to cast- Returns:
- the generated menu entry
-
generateMenu
Generates a menu entry for using an item on this entity.- Parameters:
interactMethod- the interaction method to use (null for default)item- the inventory item to use- Returns:
- the generated menu entry
-
generateMenu
Generates a menu entry for a named action using a specific interaction method.- Parameters:
interactMethod- the interaction method to use (null for default)action- the action name- Returns:
- the generated menu entry
-
generateMenu
Generates a menu entry for the specified action index using default interaction.- Parameters:
actionIndex- the action index (0-4)- Returns:
- the generated menu entry
-
generateMenu
Generates a menu entry for a specific opcode using default interaction.- Parameters:
opcode- the menu action opcode- Returns:
- the generated menu entry
-
generateMenu
Generates a menu entry for a named action using default interaction.- Parameters:
action- the action name- Returns:
- the generated menu entry
-
generateMenu
Generates a menu entry for casting a spell using default interaction.- Parameters:
spell- the spell to cast- Returns:
- the generated menu entry
-
generateMenu
Generates a menu entry for using an item using default interaction.- Parameters:
item- the inventory item to use- Returns:
- the generated menu entry
-
interact
Performs an interaction using a pre-built menu entry.- Parameters:
automatedMenu- the menu entry to execute
-
interact
Interacts with this entity using a specific action index and interaction method.- Parameters:
interactMethod- the interaction method to use (null for default)index- the action index (0-4)
-
interact
Interacts with this entity using a specific opcode and interaction method.- Parameters:
interactMethod- the interaction method to use (null for default)opcode- the menu action opcode
-
interact
default void interact(int index) Interacts with this entity using a specific action index and default interaction.- Parameters:
index- the action index (0-4)
-
interact
default void interact(net.runelite.api.MenuAction opcode) Interacts with this entity using a specific opcode and default interaction.- Parameters:
opcode- the menu action opcode
-
interact
Interacts with the first action matching a predicate.- Parameters:
interactMethod- the interaction method to use (null for default)predicate- the predicate to match actions against
-
interact
Interacts with the first action matching a predicate using default interaction.- Parameters:
predicate- the predicate to match actions against
-
interact
Interacts with a named action using a specific interaction method.- Parameters:
interactMethod- the interaction method to use (null for default)action- the action name (e.g., "Attack", "Talk-to")
-
interact
Interacts with a named action using default interaction.This is the most common way to interact with entities.
- Parameters:
action- the action name (e.g., "Attack", "Talk-to")
-
interact
Interacts with the first matching action from multiple options.- Parameters:
interactMethod- the interaction method to use (null for default)actions- the action names to try, in order of preference
-
interact
Interacts with the first matching action from multiple options using default interaction.Useful when an entity may have different actions in different states.
- Parameters:
actions- the action names to try, in order of preference
-
interact
default void interact()Interacts with the first (default) action on this entity.Equivalent to left-clicking the entity.
-
interact
Casts a spell on this entity.- Parameters:
interactMethod- the interaction method to use (null for default)spell- the spell to cast
-
interact
Casts a spell on this entity using default interaction.- Parameters:
spell- the spell to cast
-
interact
Uses an inventory item on this entity.- Parameters:
interactMethod- the interaction method to use (null for default)item- the inventory item to use
-
interact
Uses an inventory item on this entity using default interaction.- Parameters:
item- the inventory item to use
-