Package net.runelite.api.coords
Class LocalPoint
- java.lang.Object
-
- net.runelite.api.coords.LocalPoint
-
public final class LocalPoint extends Object
A two-dimensional point in the local coordinate space.Local points are immutable, however since the local coordinate space moves, it is not safe to keep a LocalPoint after a loading zone.
The unit of a LocalPoint is 1/128th of a tile.
-
-
Constructor Summary
Constructors Constructor Description LocalPoint(int x, int y)
Deprecated.LocalPoint(int x, int y, int worldView)
LocalPoint(int x, int y, WorldView wv)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description int
distanceTo(LocalPoint other)
Gets the distance between this point and another.LocalPoint
dx(int dx)
LocalPoint
dy(int dy)
boolean
equals(Object o)
static LocalPoint
fromScene(int x, int y)
Deprecated.static LocalPoint
fromScene(int x, int y, Scene scene)
Gets the coordinate at the center of the passed tile.static LocalPoint
fromScene(int x, int y, WorldView wv)
Gets the coordinate at the center of the passed tile.static LocalPoint
fromWorld(Client client, int x, int y)
Deprecated.static LocalPoint
fromWorld(Client client, WorldPoint world)
Deprecated.static LocalPoint
fromWorld(Scene scene, int x, int y)
Gets the local coordinate at the center of the passed tile.static LocalPoint
fromWorld(WorldView wv, int x, int y)
Gets the local coordinate at the center of the passed tile.static LocalPoint
fromWorld(WorldView wv, WorldPoint world)
Gets the local coordinate at the center of the passed tile.int
getSceneX()
Gets the x-axis coordinate in scene space (tiles).int
getSceneY()
Gets the y-axis coordinate in scene space (tiles).int
getWorldView()
int
getX()
X and Y axis coordinates.int
getY()
int
hashCode()
boolean
isInScene()
Test if this point is in the basic 104x104 tile scene.LocalPoint
plus(int dx, int dy)
String
toString()
-
-
-
Constructor Detail
-
LocalPoint
public LocalPoint(int x, int y, WorldView wv)
-
LocalPoint
@Deprecated public LocalPoint(int x, int y)
Deprecated.
-
LocalPoint
public LocalPoint(int x, int y, int worldView)
-
-
Method Detail
-
fromWorld
@Nullable @Deprecated public static LocalPoint fromWorld(Client client, WorldPoint world)
Deprecated.
-
fromWorld
@Nullable public static LocalPoint fromWorld(WorldView wv, WorldPoint world)
Gets the local coordinate at the center of the passed tile.- Returns:
- coordinate if the tile is in the world view, otherwise null
-
fromWorld
@Deprecated @Nullable public static LocalPoint fromWorld(Client client, int x, int y)
Deprecated.
-
fromWorld
@Nullable public static LocalPoint fromWorld(WorldView wv, int x, int y)
Gets the local coordinate at the center of the passed tile.- Parameters:
wv
- the scenex
- x-axis coordinate of the tiley
- y-axis coordinate of the tile- Returns:
- coordinate if the tile is in the current scene, otherwise null
-
fromWorld
@Nullable public static LocalPoint fromWorld(Scene scene, int x, int y)
Gets the local coordinate at the center of the passed tile.- Parameters:
scene
- the scenex
- x-axis coordinate of the tiley
- y-axis coordinate of the tile- Returns:
- coordinate if the tile is in the current scene, otherwise null
-
distanceTo
public int distanceTo(LocalPoint other)
Gets the distance between this point and another.- Parameters:
other
- other point- Returns:
- the distance
-
isInScene
public boolean isInScene()
Test if this point is in the basic 104x104 tile scene.- Returns:
-
fromScene
@Deprecated public static LocalPoint fromScene(int x, int y)
Deprecated.Gets the coordinate at the center of the passed tile.- Parameters:
x
- x-axis coordinate of the tile in Scene coordsy
- y-axis coordinate of the tile in Scene coords- Returns:
- true coordinate of the tile
-
fromScene
public static LocalPoint fromScene(int x, int y, Scene scene)
Gets the coordinate at the center of the passed tile.- Parameters:
x
- x-axis coordinate of the tile in Scene coordsy
- y-axis coordinate of the tile in Scene coordsscene
- scene containing the tile- Returns:
- true coordinate of the tile
-
fromScene
public static LocalPoint fromScene(int x, int y, WorldView wv)
Gets the coordinate at the center of the passed tile.- Parameters:
x
- x-axis coordinate of the tile in Scene coordsy
- y-axis coordinate of the tile in Scene coordswv
- wv containing the tile- Returns:
- true coordinate of the tile
-
getSceneX
public int getSceneX()
Gets the x-axis coordinate in scene space (tiles).- Returns:
- x-axis coordinate
-
getSceneY
public int getSceneY()
Gets the y-axis coordinate in scene space (tiles).- Returns:
- y-axis coordinate
-
dx
public LocalPoint dx(int dx)
-
dy
public LocalPoint dy(int dy)
-
plus
public LocalPoint plus(int dx, int dy)
-
getX
public int getX()
X and Y axis coordinates.
-
getY
public int getY()
-
getWorldView
public int getWorldView()
-
-