Package net.storm.api.interact.builder
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 NPCsItemMenuBuilder- For inventory itemsTileEntityMenuBuilder- For game objectsWidgetMenuBuilder- 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 TypeMethodDescriptionactionIndex(Integer actionIndex) Sets the action index for the menu entry.default AutomatedMenubuild(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).interactMethod(InteractMethod interactMethod) Sets the interaction method to use.Sets the item ID for item-based actions.opcode(net.runelite.api.MenuAction opcode) Sets the menu action opcode.Sets the menu option text (e.g., "Attack", "Talk-to", "Use").Sets parameter 0 for the menu entry.Sets parameter 1 for the menu entry.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
Sets the action index for the menu entry.- Parameters:
actionIndex- the action index- Returns:
- this builder
-
identifier
Sets the identifier (typically entity index or ID).- Parameters:
identifier- the identifier- Returns:
- this builder
-
option
Sets the menu option text (e.g., "Attack", "Talk-to", "Use").- Parameters:
option- the option text- Returns:
- this builder
-
target
Sets the menu target text (e.g., entity name).- Parameters:
target- the target text- Returns:
- this builder
-
opcode
Sets the menu action opcode.- Parameters:
opcode- the menu action opcode- Returns:
- this builder
-
param0
Sets parameter 0 for the menu entry.- Parameters:
param0- parameter 0- Returns:
- this builder
-
param1
Sets parameter 1 for the menu entry.- Parameters:
param1- parameter 1- Returns:
- this builder
-
itemId
Sets the item ID for item-based actions.- Parameters:
itemId- the item ID- Returns:
- this builder
-
worldViewId
Sets the world view ID for instanced areas.- Parameters:
worldViewId- the world view ID- Returns:
- this builder
-
interactMethod
Sets the interaction method to use.- Parameters:
interactMethod- the interaction method- Returns:
- this builder
-
useItem
Configures this menu entry to use an item on the target.- Parameters:
itemId- the item ID to useslot- the inventory slot containing the item- Returns:
- this builder
-
castSpell
Configures this menu entry to cast a spell on the target.- Parameters:
spell- the spell to cast- Returns:
- this builder
-
build
Builds the automated menu action with integer coordinates.- Parameters:
clickX- the X coordinate for the interactionclickY- the Y coordinate for the interaction- Returns:
- the automated menu action
-
build
Builds the automated menu action with a coordinate.- Parameters:
coordinate- the coordinate for the interaction- Returns:
- the automated menu action
-