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 Type
    Method
    Description
    generateMenu(int actionIndex)
    Generates a menu entry for the specified action index using default interaction.
    Generates a menu entry for a named action using default interaction.
    generateMenu(net.runelite.api.MenuAction opcode)
    Generates a menu entry for a specific opcode using default interaction.
    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.
    generateMenu(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.
    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.
    Generates a menu entry for casting a spell using default interaction.
    default int
    Gets the index of a specific action in the actions array.
    Gets the available right-click menu actions for this entity.
    Gets a suitable click point on this entity for mouse interaction.
    default boolean
    Checks if this entity has any non-empty actions.
    default boolean
    hasAction(String... actions)
    Checks if this entity has any of the specified actions.
    default boolean
    Checks if this entity has an action matching the given filter.
    default void
    Interacts with the first (default) action on this entity.
    default void
    interact(int index)
    Interacts with this entity using a specific action index and default interaction.
    default void
    interact(String action)
    Interacts with a named action using default interaction.
    default void
    interact(String... actions)
    Interacts with the first matching action from multiple options using default interaction.
    default void
    Interacts with the first action matching a predicate using default interaction.
    default void
    interact(net.runelite.api.MenuAction opcode)
    Interacts with this entity using a specific opcode and default interaction.
    default void
    Uses an inventory item on this entity using default interaction.
    void
    interact(AutomatedMenu automatedMenu)
    Performs an interaction using a pre-built menu entry.
    default void
    interact(InteractMethod interactMethod, int index)
    Interacts with this entity using a specific action index and interaction method.
    default void
    interact(InteractMethod interactMethod, String action)
    Interacts with a named action using a specific interaction method.
    default void
    interact(InteractMethod interactMethod, String... actions)
    Interacts with the first matching action from multiple options.
    default void
    interact(InteractMethod interactMethod, Predicate<String> predicate)
    Interacts with the first action matching a predicate.
    default void
    interact(InteractMethod interactMethod, net.runelite.api.MenuAction opcode)
    Interacts with this entity using a specific opcode and interaction method.
    default void
    interact(InteractMethod interactMethod, IInventoryItem item)
    Uses an inventory item on this entity.
    default void
    interact(InteractMethod interactMethod, Spell spell)
    Casts a spell on this entity.
    default void
    interact(Spell spell)
    Casts a spell on this entity using default interaction.
    boolean
    Checks if this entity can be interacted with from the local player's position.
    boolean
    isInteractable(net.runelite.api.coords.WorldPoint from)
    Checks if this entity can be interacted with from a specific position.
    default boolean
    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

      default boolean isInteractable(Locatable from)
      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

      @Nullable String[] 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

      default int getActionIndex(String action)
      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

      default boolean hasAction(Predicate<String> filter)
      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

      default boolean hasAction(String... actions)
      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

      AutomatedMenu generateMenu(InteractMethod interactMethod, int actionIndex)
      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

      AutomatedMenu generateMenu(InteractMethod interactMethod, net.runelite.api.MenuAction opcode)
      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

      AutomatedMenu generateMenu(InteractMethod interactMethod, Spell spell)
      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

      AutomatedMenu generateMenu(InteractMethod interactMethod, IInventoryItem item)
      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

      default AutomatedMenu generateMenu(InteractMethod interactMethod, String action)
      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

      default AutomatedMenu generateMenu(int actionIndex)
      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

      default AutomatedMenu generateMenu(net.runelite.api.MenuAction opcode)
      Generates a menu entry for a specific opcode using default interaction.
      Parameters:
      opcode - the menu action opcode
      Returns:
      the generated menu entry
    • generateMenu

      default AutomatedMenu generateMenu(String action)
      Generates a menu entry for a named action using default interaction.
      Parameters:
      action - the action name
      Returns:
      the generated menu entry
    • generateMenu

      default AutomatedMenu generateMenu(Spell spell)
      Generates a menu entry for casting a spell using default interaction.
      Parameters:
      spell - the spell to cast
      Returns:
      the generated menu entry
    • generateMenu

      default AutomatedMenu generateMenu(IInventoryItem item)
      Generates a menu entry for using an item using default interaction.
      Parameters:
      item - the inventory item to use
      Returns:
      the generated menu entry
    • interact

      void interact(AutomatedMenu automatedMenu)
      Performs an interaction using a pre-built menu entry.
      Parameters:
      automatedMenu - the menu entry to execute
    • interact

      default void interact(InteractMethod interactMethod, int index)
      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

      default void interact(InteractMethod interactMethod, net.runelite.api.MenuAction opcode)
      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

      default void interact(InteractMethod interactMethod, Predicate<String> predicate)
      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

      default void interact(Predicate<String> predicate)
      Interacts with the first action matching a predicate using default interaction.
      Parameters:
      predicate - the predicate to match actions against
    • interact

      default void interact(InteractMethod interactMethod, String action)
      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

      default void interact(String action)
      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

      default void interact(InteractMethod interactMethod, String... actions)
      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

      default void interact(String... actions)
      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

      default void interact(InteractMethod interactMethod, Spell spell)
      Casts a spell on this entity.
      Parameters:
      interactMethod - the interaction method to use (null for default)
      spell - the spell to cast
    • interact

      default void interact(Spell spell)
      Casts a spell on this entity using default interaction.
      Parameters:
      spell - the spell to cast
    • interact

      default void interact(InteractMethod interactMethod, IInventoryItem item)
      Uses an inventory item on this entity.
      Parameters:
      interactMethod - the interaction method to use (null for default)
      item - the inventory item to use
    • interact

      default void interact(IInventoryItem item)
      Uses an inventory item on this entity using default interaction.
      Parameters:
      item - the inventory item to use