project(internal): mixins and rsc changes

This commit is contained in:
Owain van Brakel
2022-05-24 23:22:56 +02:00
parent 0036e1c596
commit e9baf78efb
6 changed files with 242 additions and 26 deletions

View File

@@ -24,58 +24,77 @@
*/
package net.runelite.api.events;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import net.runelite.api.MenuAction;
import net.runelite.api.MenuEntry;
/**
* An event when a new entry is added to a right-click menu.
*/
@EqualsAndHashCode(onlyExplicitlyIncluded = true)
@ToString(onlyExplicitlyIncluded = true)
public class MenuEntryAdded
{
// Here for RuneLite compatibility (different parameter order)
public MenuEntryAdded(String option, String target, int type, int identifier, int actionParam0, int actionParam1)
public MenuEntryAdded(MenuEntry menuEntry)
{
this(option, target, identifier, type, actionParam0, actionParam1, false);
}
this.menuEntry = menuEntry;
public MenuEntryAdded(String option, String target, int identifier, int type, int param0, int param1, boolean forceLeftClick)
{
this.option = option;
this.target = target;
this.identifier = identifier;
this.type = type;
this.actionParam0 = param0;
this.actionParam1 = param1;
this.forceLeftClick = forceLeftClick;
this.option = menuEntry.getOption();
this.target = menuEntry.getTarget();
this.identifier = menuEntry.getIdentifier();
this.type = menuEntry.getType().getId();
this.actionParam0 = menuEntry.getParam0();
this.actionParam1 = menuEntry.getParam1();
this.forceLeftClick = false;
}
@Getter
private final MenuEntry menuEntry;
@Getter
@Setter
@EqualsAndHashCode.Include
@ToString.Include
private String option;
@Getter
@Setter
@EqualsAndHashCode.Include
@ToString.Include
private String target;
@Getter
@Setter
@EqualsAndHashCode.Include
@ToString.Include
private int type;
@Getter
@Setter
@EqualsAndHashCode.Include
@ToString.Include
private int identifier;
@Getter
@Setter
@EqualsAndHashCode.Include
@ToString.Include
private int actionParam0;
@Getter
@Setter
@EqualsAndHashCode.Include
@ToString.Include
private int actionParam1;
@Getter
@Setter
@EqualsAndHashCode.Include
@ToString.Include
private boolean forceLeftClick;
/**
@@ -87,6 +106,8 @@ public class MenuEntryAdded
*/
@Getter
@Setter
@EqualsAndHashCode.Include
@ToString.Include
private boolean modified;
public void setModified()
@@ -134,4 +155,4 @@ public class MenuEntryAdded
{
return MenuAction.of(type);
}
}
}

View File

@@ -24,9 +24,12 @@
*/
package net.runelite.api.events;
import javax.annotation.Nullable;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import lombok.Setter;
import lombok.ToString;
import net.runelite.api.MenuAction;
import net.runelite.api.MenuEntry;
import net.runelite.api.widgets.Widget;
@@ -43,12 +46,16 @@ import net.runelite.api.widgets.Widget;
* it seems that this event still triggers with the "Cancel" action.
*/
@RequiredArgsConstructor
@EqualsAndHashCode(onlyExplicitlyIncluded = true)
@ToString(onlyExplicitlyIncluded = true)
public class MenuOptionClicked
{
/**
* The clicked menu entry
*/
@Getter
private final MenuEntry menuEntry;
/**
* Whether or not the event has been consumed by a subscriber.
*/
@@ -59,6 +66,8 @@ public class MenuOptionClicked
/**
* Action parameter 0. Its value depends on the menuAction.
*/
@EqualsAndHashCode.Include
@ToString.Include
public int getParam0()
{
return menuEntry.getParam0();
@@ -72,6 +81,8 @@ public class MenuOptionClicked
/**
* Action parameter 1. Its value depends on the menuAction.
*/
@EqualsAndHashCode.Include
@ToString.Include
public int getParam1()
{
return menuEntry.getParam1();
@@ -85,6 +96,8 @@ public class MenuOptionClicked
/**
* The option text added to the menu.
*/
@EqualsAndHashCode.Include
@ToString.Include
public String getMenuOption()
{
return menuEntry.getOption();
@@ -98,6 +111,8 @@ public class MenuOptionClicked
/**
* The target of the action.
*/
@EqualsAndHashCode.Include
@ToString.Include
public String getMenuTarget()
{
return menuEntry.getTarget();
@@ -111,6 +126,8 @@ public class MenuOptionClicked
/**
* The action performed.
*/
@EqualsAndHashCode.Include
@ToString.Include
public MenuAction getMenuAction()
{
return menuEntry.getType();
@@ -124,6 +141,8 @@ public class MenuOptionClicked
/**
* The ID of the object, actor, or item that the interaction targets.
*/
@EqualsAndHashCode.Include
@ToString.Include
public int getId()
{
return menuEntry.getIdentifier();
@@ -168,6 +187,7 @@ public class MenuOptionClicked
* with an associated widget. Such as eg, CC_OP.
* @return
*/
@Nullable
public Widget getWidget()
{
return menuEntry.getWidget();

View File

@@ -191,6 +191,9 @@ public interface Widget
*/
void setForcedPosition(int x, int y);
void setForcedX();
void setForcedY();
/**
* Gets the text displayed on this widget.
*