mixins/api: fix broken mixin + more
mixins/api: fix broken mixin + more fix broken mixins add new mixins add new api support
This commit is contained in:
@@ -103,4 +103,14 @@ public interface TileObject extends Locatable
|
||||
*/
|
||||
@Nullable
|
||||
Shape getClickbox();
|
||||
|
||||
/**
|
||||
* Gets the name of the object
|
||||
*/
|
||||
String getName();
|
||||
|
||||
/**
|
||||
* Gets the menu actions of the object
|
||||
*/
|
||||
String[] getActions();
|
||||
}
|
||||
|
||||
@@ -74,6 +74,42 @@ public abstract class TileObjectQuery<EntityType extends TileObject, QueryType>
|
||||
return (QueryType) this;
|
||||
}
|
||||
|
||||
public QueryType nameEquals(String... names)
|
||||
{
|
||||
predicate = and(object ->
|
||||
{
|
||||
for (String name : names)
|
||||
{
|
||||
String objectName = object.getName();
|
||||
if (objectName != null && objectName.equals(name))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
});
|
||||
return (QueryType) this;
|
||||
}
|
||||
|
||||
public QueryType actionEquals(String... actions)
|
||||
{
|
||||
predicate = and(object ->
|
||||
{
|
||||
for (String action : actions)
|
||||
{
|
||||
String[] objectActions = object.getActions();
|
||||
for (String objectAction : objectActions)
|
||||
{
|
||||
if (objectAction != null && objectAction.equals(action))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
});
|
||||
return (QueryType) this;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public QueryType idEquals(Collection<Integer> ids)
|
||||
|
||||
@@ -253,7 +253,7 @@ public abstract class RSClientMixin implements RSClient
|
||||
private boolean isMirrored = false;
|
||||
|
||||
@Inject
|
||||
private boolean comparingAppearance = false;
|
||||
private Integer comparingAppearance = 0;
|
||||
|
||||
@Inject
|
||||
private List<String> outdatedScripts = new ArrayList<>();
|
||||
@@ -2017,14 +2017,14 @@ public abstract class RSClientMixin implements RSClient
|
||||
@Override
|
||||
public boolean isComparingAppearance()
|
||||
{
|
||||
return comparingAppearance;
|
||||
return comparingAppearance > 0;
|
||||
}
|
||||
|
||||
@Inject
|
||||
@Override
|
||||
public void setComparingAppearance(boolean comparingAppearance)
|
||||
{
|
||||
this.comparingAppearance = comparingAppearance;
|
||||
this.comparingAppearance += comparingAppearance ? 1 : -1;
|
||||
}
|
||||
|
||||
@Inject
|
||||
|
||||
@@ -37,6 +37,20 @@ public abstract class RSTileObjectMixin implements TileObject
|
||||
long hash = getHash();
|
||||
return (int) (hash >>> 17 & 4294967295L);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Inject
|
||||
public String getName()
|
||||
{
|
||||
return client.getObjectDefinition(getId()).getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
@Inject
|
||||
public String[] getActions()
|
||||
{
|
||||
return client.getObjectDefinition(getId()).getActions();
|
||||
}
|
||||
|
||||
@Override
|
||||
@Inject
|
||||
|
||||
Reference in New Issue
Block a user