Interface MenuBuilder<B extends MenuBuilder<B>>

Type Parameters:
B - the concrete builder type (for fluent chaining)
All Known Subinterfaces:
ActorMenuBuilder, ItemMenuBuilder, TileEntityMenuBuilder, WidgetMenuBuilder

public interface MenuBuilder<B extends MenuBuilder<B>>
Fluent builder interface for constructing menu interactions.

Menu builders provide a type-safe way to create automated menu actions (right-click menu selections) for game entities. Different builder implementations exist for different entity types:

  • ActorMenuBuilder - For players and NPCs
  • ItemMenuBuilder - For inventory items
  • TileEntityMenuBuilder - For game objects
  • WidgetMenuBuilder - For UI widgets

Example usage:

 
 IMenuFactory menuFactory = Static.getMenuFactory();
 AutomatedMenu menu = menuFactory.actorMenu()
     .option("Attack")
     .target(npc.getName())
     .identifier(npc.getIndex())
     .build(npc.getCoordinate());
 
 

See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    actionIndex(Integer actionIndex)
    Sets the action index for the menu entry.
    build(int clickX, int clickY)
    Builds the automated menu action with integer coordinates.
    build(Coordinate coordinate)
    Builds the automated menu action with a coordinate.
    Configures this menu entry to cast a spell on the target.
    identifier(Integer identifier)
    Sets the identifier (typically entity index or ID).
    Sets the interaction method to use.
    itemId(Integer itemId)
    Sets the item ID for item-based actions.
    opcode(net.runelite.api.MenuAction opcode)
    Sets the menu action opcode.
    option(String option)
    Sets the menu option text (e.g., "Attack", "Talk-to", "Use").
    param0(Integer param0)
    Sets parameter 0 for the menu entry.
    param1(Integer param1)
    Sets parameter 1 for the menu entry.
    target(String target)
    Sets the menu target text (e.g., entity name).
    useItem(int itemId, int slot)
    Configures this menu entry to use an item on the target.
    worldViewId(Integer worldViewId)
    Sets the world view ID for instanced areas.
  • Method Details

    • actionIndex

      B actionIndex(Integer actionIndex)
      Sets the action index for the menu entry.
      Parameters:
      actionIndex - the action index
      Returns:
      this builder
    • identifier

      B identifier(Integer identifier)
      Sets the identifier (typically entity index or ID).
      Parameters:
      identifier - the identifier
      Returns:
      this builder
    • option

      B option(String option)
      Sets the menu option text (e.g., "Attack", "Talk-to", "Use").
      Parameters:
      option - the option text
      Returns:
      this builder
    • target

      B target(String target)
      Sets the menu target text (e.g., entity name).
      Parameters:
      target - the target text
      Returns:
      this builder
    • opcode

      B opcode(net.runelite.api.MenuAction opcode)
      Sets the menu action opcode.
      Parameters:
      opcode - the menu action opcode
      Returns:
      this builder
    • param0

      B param0(Integer param0)
      Sets parameter 0 for the menu entry.
      Parameters:
      param0 - parameter 0
      Returns:
      this builder
    • param1

      B param1(Integer param1)
      Sets parameter 1 for the menu entry.
      Parameters:
      param1 - parameter 1
      Returns:
      this builder
    • itemId

      B itemId(Integer itemId)
      Sets the item ID for item-based actions.
      Parameters:
      itemId - the item ID
      Returns:
      this builder
    • worldViewId

      B worldViewId(Integer worldViewId)
      Sets the world view ID for instanced areas.
      Parameters:
      worldViewId - the world view ID
      Returns:
      this builder
    • interactMethod

      B interactMethod(InteractMethod interactMethod)
      Sets the interaction method to use.
      Parameters:
      interactMethod - the interaction method
      Returns:
      this builder
    • useItem

      B useItem(int itemId, int slot)
      Configures this menu entry to use an item on the target.
      Parameters:
      itemId - the item ID to use
      slot - the inventory slot containing the item
      Returns:
      this builder
    • castSpell

      B castSpell(Spell spell)
      Configures this menu entry to cast a spell on the target.
      Parameters:
      spell - the spell to cast
      Returns:
      this builder
    • build

      default AutomatedMenu build(int clickX, int clickY)
      Builds the automated menu action with integer coordinates.
      Parameters:
      clickX - the X coordinate for the interaction
      clickY - the Y coordinate for the interaction
      Returns:
      the automated menu action
    • build

      AutomatedMenu build(Coordinate coordinate)
      Builds the automated menu action with a coordinate.
      Parameters:
      coordinate - the coordinate for the interaction
      Returns:
      the automated menu action