Update almost everything to the new API
This commit is contained in:
@@ -26,8 +26,8 @@ package net.runelite.api.queries;
|
||||
|
||||
import static java.lang.Math.abs;
|
||||
import net.runelite.api.Actor;
|
||||
import net.runelite.api.Point;
|
||||
import net.runelite.api.Query;
|
||||
import net.runelite.api.coords.LocalPoint;
|
||||
|
||||
public abstract class ActorQuery<EntityType extends Actor, QueryType> extends Query<EntityType, QueryType>
|
||||
{
|
||||
@@ -68,7 +68,7 @@ public abstract class ActorQuery<EntityType extends Actor, QueryType> extends Qu
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public QueryType atLocalLocation(Point location)
|
||||
public QueryType atLocalLocation(LocalPoint location)
|
||||
{
|
||||
predicate = and(actor -> actor.getLocalLocation().equals(location));
|
||||
return (QueryType) this;
|
||||
@@ -96,18 +96,18 @@ public abstract class ActorQuery<EntityType extends Actor, QueryType> extends Qu
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public QueryType isWithinDistance(Point to, int distance)
|
||||
public QueryType isWithinDistance(LocalPoint to, int distance)
|
||||
{
|
||||
predicate = and(a -> a.getLocalLocation().distanceTo(to) <= distance);
|
||||
return (QueryType) this;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public QueryType isWithinArea(Point from, int area)
|
||||
public QueryType isWithinArea(LocalPoint from, int area)
|
||||
{
|
||||
predicate = and(a ->
|
||||
{
|
||||
Point localLocation = a.getLocalLocation();
|
||||
LocalPoint localLocation = a.getLocalLocation();
|
||||
return abs(localLocation.getX() - from.getX()) < area
|
||||
&& abs(localLocation.getY() - from.getY()) < area;
|
||||
});
|
||||
|
||||
@@ -26,7 +26,6 @@ package net.runelite.api.queries;
|
||||
|
||||
import static java.lang.Math.abs;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.Point;
|
||||
import net.runelite.api.Query;
|
||||
import net.runelite.api.Region;
|
||||
import net.runelite.api.Tile;
|
||||
@@ -34,6 +33,8 @@ import net.runelite.api.TileObject;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import net.runelite.api.coords.LocalPoint;
|
||||
import net.runelite.api.coords.WorldPoint;
|
||||
|
||||
public abstract class TileObjectQuery<EntityType extends TileObject, QueryType> extends Query<EntityType, QueryType>
|
||||
{
|
||||
@@ -78,32 +79,32 @@ public abstract class TileObjectQuery<EntityType extends TileObject, QueryType>
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public QueryType atWorldLocation(Point location)
|
||||
public QueryType atWorldLocation(WorldPoint location)
|
||||
{
|
||||
predicate = and(object -> object.getWorldLocation().equals(location));
|
||||
return (QueryType) this;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public QueryType atLocalLocation(Point location)
|
||||
public QueryType atLocalLocation(LocalPoint location)
|
||||
{
|
||||
predicate = and(object -> object.getLocalLocation().equals(location));
|
||||
return (QueryType) this;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public QueryType isWithinDistance(Point to, int distance)
|
||||
public QueryType isWithinDistance(LocalPoint to, int distance)
|
||||
{
|
||||
predicate = and(a -> a.getLocalLocation().distanceTo(to) <= distance);
|
||||
return (QueryType) this;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public QueryType isWithinArea(Point from, int area)
|
||||
public QueryType isWithinArea(LocalPoint from, int area)
|
||||
{
|
||||
predicate = and(a ->
|
||||
{
|
||||
Point localLocation = a.getLocalLocation();
|
||||
LocalPoint localLocation = a.getLocalLocation();
|
||||
return abs(localLocation.getX() - from.getX()) < area
|
||||
&& abs(localLocation.getY() - from.getY()) < area;
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user