Update almost everything to the new API
This commit is contained in:
@@ -27,6 +27,8 @@ package net.runelite.api;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.Polygon;
|
||||
import java.awt.image.BufferedImage;
|
||||
import net.runelite.api.coords.LocalPoint;
|
||||
import net.runelite.api.coords.WorldPoint;
|
||||
|
||||
public interface Actor extends Renderable
|
||||
{
|
||||
@@ -40,9 +42,9 @@ public interface Actor extends Renderable
|
||||
|
||||
int getHealth();
|
||||
|
||||
Point getWorldLocation();
|
||||
WorldPoint getWorldLocation();
|
||||
|
||||
Point getLocalLocation();
|
||||
LocalPoint getLocalLocation();
|
||||
|
||||
int getOrientation();
|
||||
|
||||
@@ -62,8 +64,6 @@ public interface Actor extends Renderable
|
||||
|
||||
Point getMinimapLocation();
|
||||
|
||||
Point getRegionLocation();
|
||||
|
||||
/**
|
||||
* Returns the logical height of the actor's model. This is roughly where the health bar is drawn.
|
||||
*/
|
||||
|
||||
@@ -28,6 +28,8 @@ import java.awt.Canvas;
|
||||
import java.awt.Dimension;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import javax.annotation.Nullable;
|
||||
import net.runelite.api.coords.LocalPoint;
|
||||
import net.runelite.api.widgets.Widget;
|
||||
import net.runelite.api.widgets.WidgetInfo;
|
||||
|
||||
@@ -184,7 +186,8 @@ public interface Client extends GameEngine
|
||||
|
||||
SpritePixels createSpritePixels(int[] pixels, int width, int height);
|
||||
|
||||
Point getSceneDestinationLocation();
|
||||
@Nullable
|
||||
LocalPoint getLocalDestinationLocation();
|
||||
|
||||
List<Projectile> getProjectiles();
|
||||
|
||||
|
||||
@@ -34,6 +34,7 @@ import java.awt.image.BufferedImage;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
import net.runelite.api.coords.LocalPoint;
|
||||
import net.runelite.api.model.Jarvis;
|
||||
import net.runelite.api.model.Triangle;
|
||||
import net.runelite.api.model.Vertex;
|
||||
@@ -218,7 +219,7 @@ public class Perspective
|
||||
{
|
||||
int angle = client.getMapAngle() & 0x7FF;
|
||||
|
||||
Point localLocation = client.getLocalPlayer().getLocalLocation();
|
||||
LocalPoint localLocation = client.getLocalPlayer().getLocalLocation();
|
||||
x = x / 32 - localLocation.getX() / 32;
|
||||
y = y / 32 - localLocation.getY() / 32;
|
||||
|
||||
@@ -328,7 +329,7 @@ public class Perspective
|
||||
* @return a {@link Polygon} on screen corresponding to the given
|
||||
* localLocation.
|
||||
*/
|
||||
public static Polygon getCanvasTilePoly(Client client, Point localLocation)
|
||||
public static Polygon getCanvasTilePoly(Client client, LocalPoint localLocation)
|
||||
{
|
||||
return getCanvasTileAreaPoly(client, localLocation, 1);
|
||||
}
|
||||
@@ -342,7 +343,7 @@ public class Perspective
|
||||
* size = 3
|
||||
* @return a polygon representing the tiles in the area
|
||||
*/
|
||||
public static Polygon getCanvasTileAreaPoly(Client client, Point localLocation, int size)
|
||||
public static Polygon getCanvasTileAreaPoly(Client client, LocalPoint localLocation, int size)
|
||||
{
|
||||
int plane = client.getPlane();
|
||||
int halfTile = LOCAL_TILE_SIZE / 2;
|
||||
@@ -391,7 +392,7 @@ public class Perspective
|
||||
* @return a {@link Point} on screen corresponding to the given
|
||||
* localLocation.
|
||||
*/
|
||||
public static Point getCanvasTextLocation(Client client, Graphics2D graphics, Point localLocation, String text, int zOffset)
|
||||
public static Point getCanvasTextLocation(Client client, Graphics2D graphics, LocalPoint localLocation, String text, int zOffset)
|
||||
{
|
||||
int plane = client.getPlane();
|
||||
|
||||
@@ -420,7 +421,7 @@ public class Perspective
|
||||
* @return a {@link Point} on screen corresponding to the given
|
||||
* localLocation.
|
||||
*/
|
||||
public static Point getCanvasImageLocation(Client client, Graphics2D graphics, Point localLocation, BufferedImage image, int zOffset)
|
||||
public static Point getCanvasImageLocation(Client client, Graphics2D graphics, LocalPoint localLocation, BufferedImage image, int zOffset)
|
||||
{
|
||||
int plane = client.getPlane();
|
||||
|
||||
@@ -446,7 +447,7 @@ public class Perspective
|
||||
* @return a {@link Point} on screen corresponding to the given
|
||||
* localLocation.
|
||||
*/
|
||||
public static Point getMiniMapImageLocation(Client client, Point localLocation, BufferedImage image)
|
||||
public static Point getMiniMapImageLocation(Client client, LocalPoint localLocation, BufferedImage image)
|
||||
{
|
||||
Point p = Perspective.worldToMiniMap(client, localLocation.getX(), localLocation.getY());
|
||||
|
||||
@@ -472,7 +473,7 @@ public class Perspective
|
||||
* @return a {@link Point} on screen corresponding to the given
|
||||
* localLocation.
|
||||
*/
|
||||
public static Point getCanvasSpriteLocation(Client client, Graphics2D graphics, Point localLocation, SpritePixels sprite, int zOffset)
|
||||
public static Point getCanvasSpriteLocation(Client client, Graphics2D graphics, LocalPoint localLocation, SpritePixels sprite, int zOffset)
|
||||
{
|
||||
int plane = client.getPlane();
|
||||
|
||||
@@ -718,7 +719,7 @@ public class Perspective
|
||||
* @return a {@link Point} on screen corresponding to the given
|
||||
* localLocation.
|
||||
*/
|
||||
public static Point getCanvasTextMiniMapLocation(Client client, Graphics2D graphics, Point localLocation, String text)
|
||||
public static Point getCanvasTextMiniMapLocation(Client client, Graphics2D graphics, LocalPoint localLocation, String text)
|
||||
{
|
||||
Point p = Perspective.worldToMiniMap(client, localLocation.getX(), localLocation.getY());
|
||||
|
||||
|
||||
@@ -24,6 +24,9 @@
|
||||
*/
|
||||
package net.runelite.api;
|
||||
|
||||
import net.runelite.api.coords.LocalPoint;
|
||||
import net.runelite.api.coords.WorldPoint;
|
||||
|
||||
public interface Tile
|
||||
{
|
||||
/**
|
||||
@@ -45,11 +48,11 @@ public interface Tile
|
||||
|
||||
SceneTileModel getSceneTileModel();
|
||||
|
||||
Point getWorldLocation();
|
||||
WorldPoint getWorldLocation();
|
||||
|
||||
Point getRegionLocation();
|
||||
|
||||
Point getLocalLocation();
|
||||
LocalPoint getLocalLocation();
|
||||
|
||||
int getPlane();
|
||||
}
|
||||
|
||||
@@ -27,6 +27,8 @@ package net.runelite.api;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.Polygon;
|
||||
import java.awt.geom.Area;
|
||||
import net.runelite.api.coords.LocalPoint;
|
||||
import net.runelite.api.coords.WorldPoint;
|
||||
|
||||
public interface TileObject
|
||||
{
|
||||
@@ -38,11 +40,9 @@ public interface TileObject
|
||||
|
||||
int getId();
|
||||
|
||||
Point getWorldLocation();
|
||||
WorldPoint getWorldLocation();
|
||||
|
||||
Point getLocalLocation();
|
||||
|
||||
Point getRegionLocation();
|
||||
LocalPoint getLocalLocation();
|
||||
|
||||
Point getCanvasLocation();
|
||||
|
||||
|
||||
@@ -25,13 +25,13 @@
|
||||
package net.runelite.api.events;
|
||||
|
||||
import lombok.Data;
|
||||
import net.runelite.api.Point;
|
||||
import net.runelite.api.Projectile;
|
||||
import net.runelite.api.coords.LocalPoint;
|
||||
|
||||
@Data
|
||||
public class ProjectileMoved
|
||||
{
|
||||
private Projectile projectile;
|
||||
private Point position;
|
||||
private int plane;
|
||||
private LocalPoint position;
|
||||
private int z;
|
||||
}
|
||||
|
||||
@@ -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