Class LocalPoint


  • public final class LocalPoint
    extends java.lang.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)  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int distanceTo​(LocalPoint other)
      Gets the distance between this point and another.
      boolean equals​(java.lang.Object o)  
      static LocalPoint fromScene​(int x, int y)
      Gets the coordinate at the center of the passed tile.
      static LocalPoint fromWorld​(Client client, int x, int y)
      Gets the local coordinate at the center of the passed tile.
      static LocalPoint fromWorld​(Client client, 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 getX()
      X and Y axis coordinates.
      int getY()  
      int hashCode()  
      boolean isInScene()
      Test if this point is in the loaded scene, a 104x104 tile area.
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • LocalPoint

        public LocalPoint​(int x,
                          int y)
    • Method Detail

      • fromWorld

        @Nullable
        public static LocalPoint fromWorld​(Client client,
                                           WorldPoint world)
        Gets the local coordinate at the center of the passed tile.
        Parameters:
        client - the client
        world - the passed tile
        Returns:
        coordinate if the tile is in the current scene, otherwise null
      • fromWorld

        public static LocalPoint fromWorld​(Client client,
                                           int x,
                                           int y)
        Gets the local coordinate at the center of the passed tile.
        Parameters:
        client - the client
        x - x-axis coordinate of the tile
        y - 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 loaded scene, a 104x104 tile area.
        Returns:
      • fromScene

        public static LocalPoint fromScene​(int x,
                                           int y)
        Gets the coordinate at the center of the passed tile.
        Parameters:
        x - x-axis coordinate of the tile in Scene coords
        y - y-axis coordinate of the tile in Scene coords
        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
      • getX

        public int getX()
        X and Y axis coordinates.
      • getY

        public int getY()
      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object