RuneHive-Tarnish
Neural OSRS Enhancement Framework
Loading...
Searching...
No Matches
com.osroyale.game.world.position.Position Class Reference

Public Member Functions

 Position (int x, int y)
 Position (int x, int y, int height)
int getX ()
int getY ()
int getHeight ()
int getLocalX ()
int getLocalY ()
int getLocalX (Position origin)
int getLocalY (Position origin)
int getChunkX ()
int getChunkY ()
boolean isWithinDistance (Position other, int radius)
double getDistance (Position other)
int getDistances (Position other)
int getManhattanDistance (Position other)
int getLongestDelta (Position other)
Position transform (int diffX, int diffY, int diffZ)
Position transform (int diffX, int diffY)
Position transform (Position other)
Position copy ()

Static Public Member Functions

static int getManhattanDistance (Interactable origin, Interactable target)
static double getDistance (Position first, Position second)
static int getManhattanDistance (Position first, Position second)
static Position create (int x, int y, int z)
static Position create (int x, int y)

Static Public Attributes

static final int HEIGHT_LEVELS = 4

Detailed Description

Represents a single tile on the game world.

Author
Graham Edgecombe

Definition at line 51 of file Position.java.

Constructor & Destructor Documentation

◆ Position() [1/2]

com.osroyale.game.world.position.Position.Position ( int x,
int y )
inline

Creates a location with a default height of 0.

Definition at line 66 of file Position.java.

◆ Position() [2/2]

com.osroyale.game.world.position.Position.Position ( int x,
int y,
int height )
inline

Creates a location.

Definition at line 71 of file Position.java.

Member Function Documentation

◆ copy()

Position com.osroyale.game.world.position.Position.copy ( )
inline

Creates a deep copy of this location.

Returns
A deep copy of this location.

Definition at line 351 of file Position.java.

◆ create() [1/2]

Position com.osroyale.game.world.position.Position.create ( int x,
int y )
inlinestatic

Creates a location.

Parameters
xThe x coordinate.
yThe y coordinate.
Returns
The location.

Definition at line 303 of file Position.java.

◆ create() [2/2]

Position com.osroyale.game.world.position.Position.create ( int x,
int y,
int z )
inlinestatic

Creates a location.

Parameters
xThe x coordinate.
yThe y coordinate.
zThe height coordinate.
Returns
The location.

Definition at line 292 of file Position.java.

◆ getChunkX()

int com.osroyale.game.world.position.Position.getChunkX ( )
inline

Gets the chunk x coordinate.

Definition at line 113 of file Position.java.

◆ getChunkY()

int com.osroyale.game.world.position.Position.getChunkY ( )
inline

Gets the chunk y coordinate.

Definition at line 118 of file Position.java.

◆ getDistance() [1/2]

double com.osroyale.game.world.position.Position.getDistance ( Position first,
Position second )
inlinestatic

Gets the Euclidean (straight-line) distance between two Position s.

Returns
The distance in tiles between the two locations.

Definition at line 227 of file Position.java.

◆ getDistance() [2/2]

double com.osroyale.game.world.position.Position.getDistance ( Position other)
inline

Gets the distance between this location and another location.

Parameters
otherThe other location.
Returns
The distance between the two locations.

Definition at line 200 of file Position.java.

◆ getDistances()

int com.osroyale.game.world.position.Position.getDistances ( Position other)
inline

Absolute distance between this Coordiante and another.

Parameters
otherThe other Coordiante.
Returns
The distance between the 2 Coordinates.

Definition at line 213 of file Position.java.

◆ getHeight()

int com.osroyale.game.world.position.Position.getHeight ( )
inline

Gets the height coordinate, or height.

Definition at line 88 of file Position.java.

◆ getLocalX() [1/2]

int com.osroyale.game.world.position.Position.getLocalX ( )
inline

Gets the local x coordinate relative to this region.

Definition at line 93 of file Position.java.

◆ getLocalX() [2/2]

int com.osroyale.game.world.position.Position.getLocalX ( Position origin)
inline

Gets the local x coordinate relative to a specific region.

Definition at line 103 of file Position.java.

◆ getLocalY() [1/2]

int com.osroyale.game.world.position.Position.getLocalY ( )
inline

Gets the local y coordinate relative to this region.

Definition at line 98 of file Position.java.

◆ getLocalY() [2/2]

int com.osroyale.game.world.position.Position.getLocalY ( Position origin)
inline

Gets the local y coordinate relative to a specific region.

Definition at line 108 of file Position.java.

◆ getLongestDelta()

int com.osroyale.game.world.position.Position.getLongestDelta ( Position other)
inline

Gets the longest horizontal or vertical delta between the two positions.

Parameters
otherThe other position.
Returns
The longest horizontal or vertical delta.

Definition at line 277 of file Position.java.

◆ getManhattanDistance() [1/3]

int com.osroyale.game.world.position.Position.getManhattanDistance ( Interactable origin,
Interactable target )
inlinestatic

Gets the manhattan distance between two interactable object.

Parameters
originThe originating location.
targetThe target location.
Returns
The distance between the origin and target.

Definition at line 173 of file Position.java.

◆ getManhattanDistance() [2/3]

int com.osroyale.game.world.position.Position.getManhattanDistance ( Position first,
Position second )
inlinestatic

Gets the Euclidean (straight-line) distance between two Position s.

Returns
The distance in tiles between the two locations.

Definition at line 265 of file Position.java.

◆ getManhattanDistance() [3/3]

int com.osroyale.game.world.position.Position.getManhattanDistance ( Position other)
inline

Gets the distance between this location and another location without diagonals.

Parameters
otherThe other location.
Returns
The distance between the two locations.

Definition at line 240 of file Position.java.

◆ getX()

int com.osroyale.game.world.position.Position.getX ( )
inline

Gets the absolute x coordinate.

Definition at line 78 of file Position.java.

◆ getY()

int com.osroyale.game.world.position.Position.getY ( )
inline

Gets the absolute y coordinate.

Definition at line 83 of file Position.java.

◆ isWithinDistance()

boolean com.osroyale.game.world.position.Position.isWithinDistance ( Position other,
int radius )
inline

Checks if this location is within range of another.

Parameters
otherThe other location.
radiusThe radius from the origin point.
Returns
True if the location is within the radius.

Definition at line 184 of file Position.java.

◆ transform() [1/3]

Position com.osroyale.game.world.position.Position.transform ( int diffX,
int diffY )
inline

Creates a new location based on this location.

Parameters
diffXX difference.
diffYY difference.
Returns
The new location.

Definition at line 326 of file Position.java.

◆ transform() [2/3]

Position com.osroyale.game.world.position.Position.transform ( int diffX,
int diffY,
int diffZ )
inline

Creates a new location based on this location.

Parameters
diffXX difference.
diffYY difference.
diffZZ difference.
Returns
The new location.

Definition at line 315 of file Position.java.

◆ transform() [3/3]

Position com.osroyale.game.world.position.Position.transform ( Position other)
inline

Creates a new location based on this location.

Parameters
otherThe difference.
Returns
The new location.

Definition at line 341 of file Position.java.

Member Data Documentation

◆ HEIGHT_LEVELS

final int com.osroyale.game.world.position.Position.HEIGHT_LEVELS = 4
static

The maximum amount of height-planes.

Definition at line 54 of file Position.java.


The documentation for this class was generated from the following file: