Search in sources :

Example 1 with MenuEntryAdded

use of net.runelite.api.events.MenuEntryAdded in project runelite by runelite.

the class MenuEntryEventMixin method onMenuOptionsChanged.

@FieldHook("menuOptionCount")
@Inject
public static void onMenuOptionsChanged(int idx) {
    int newCount = client.getMenuOptionCount();
    if (newCount == oldMenuEntryCount + 1) {
        MenuEntryAdded event = new MenuEntryAdded(client.getMenuOptions()[newCount - 1], client.getMenuTargets()[newCount - 1], client.getMenuTypes()[newCount - 1], client.getMenuIdentifiers()[newCount - 1], client.getMenuActionParams0()[newCount - 1], client.getMenuActionParams1()[newCount - 1]);
        eventBus.post(event);
    }
    oldMenuEntryCount = newCount;
}
Also used : MenuEntryAdded(net.runelite.api.events.MenuEntryAdded) Inject(net.runelite.api.mixins.Inject) FieldHook(net.runelite.api.mixins.FieldHook)

Aggregations

MenuEntryAdded (net.runelite.api.events.MenuEntryAdded)1 FieldHook (net.runelite.api.mixins.FieldHook)1 Inject (net.runelite.api.mixins.Inject)1