Class Position

java.lang.Object
org.rspeer.game.position.Position
All Implemented Interfaces:
SceneNode
Direct Known Subclasses:
AbsolutePosition, RelativePosition

public class Position extends Object implements SceneNode
Represents a Position relative to the game world
  • Constructor Details

    • Position

      public Position(int x, int y, int level)
    • Position

      public Position(int x, int y)
  • Method Details

    • fromRelative

      public static Position fromRelative(int x, int y, int level)
    • fromAbsolute

      public static Position fromAbsolute(int x, int y, int level)
    • fromScript

      public static Position fromScript(int regionX, int regionY, int insetX, int insetY, int level)
      Constructs a Position using jagex's inhouse position system.
      Returns:
      A Position comprised of regionX, regionY, insetX, insetY and floor level.
    • unpack

      public static Position unpack(int packed)
    • rotate

      public static Position rotate(int x, int y, int level, int rotation)
    • getRegionX

      public int getRegionX()
    • getRegionY

      public int getRegionY()
    • getRegionXInset

      public int getRegionXInset()
    • getRegionYInset

      public int getRegionYInset()
    • getRegionId

      public int getRegionId()
    • getChunkX

      public int getChunkX()
    • getChunkY

      public int getChunkY()
    • getChunk

      public Chunk getChunk()
    • getChunkOffset

      public IntPair getChunkOffset()
    • getX

      public int getX()
      Specified by:
      getX in interface SceneNode
    • getY

      public int getY()
      Specified by:
      getY in interface SceneNode
    • getFloorLevel

      public int getFloorLevel()
      Specified by:
      getFloorLevel in interface SceneNode
    • translate

      public Position translate(Direction d)
    • translate

      public Position translate(int x, int y)
    • toWorld

      public Position toWorld()
    • toScene

      public Position toScene()
    • toPrecise

      public Position toPrecise()
    • fromInstance

      public Position fromInstance()
    • getInstancePositions

      public List<Position> getInstancePositions()
    • isInstanced

      public boolean isInstanced()
    • getPosition

      public Position getPosition()
      Specified by:
      getPosition in interface SceneNode
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • equals

      public boolean equals(int x, int y, int level)
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • isInScene

      public boolean isInScene()
    • rotate

      public Position rotate(int rotation)
    • within

      public boolean within(Area area)
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object