Interface Locatable

    • Method Summary

      All Methods Instance Methods Abstract Methods Default Methods 
      Modifier and Type Method Description
      default boolean canReach()
      Checks if this location is reachable by the local player without obstacles
      default boolean canReach​(Tile tile)
      Checks if this location is reachable by the provided tile without obstacles
      default double distance​(Tile tile)
      Distance (as the crow flies) away from the given tile.
      default int getGridX()
      Gets grid (local) X coordinate of the given object.
      default int getGridY()
      Gets grid (local) Y coordinate of the given object.
      Tile getTile()
      Gets tile of the object.
      default TileReference getTileReference()
      Gets tile reference of the given object.
      default int getX()
      Gets X coordinate of the given object.
      default int getY()
      Gets Y coordinate of the given object.
      default int getZ()
      Gets Z coordinate of the given object.
      default int tileDistance​(Tile tile)
      Distance (Chebyshev/Tchebychev) away from the given tile.
      default double walkingDistance​(Tile tile)
      Walking distance based on pathfinding to the given tile.
    • Method Detail

      • getTile

        Tile getTile()
        Gets tile of the object.
        Returns:
        the object tile.
      • distance

        default double distance​(Tile tile)
        Distance (as the crow flies) away from the given tile.
        Parameters:
        tile - the destination tile.
        Returns:
        return the distance from the given tile as a double.
      • tileDistance

        default int tileDistance​(Tile tile)
        Distance (Chebyshev/Tchebychev) away from the given tile. This is roughly the amount of single steps/moves away the tile is. This differs from distance(Tile) because diagonals have the same cost.

        Note: this does not account for obstacles like walkingDistance(Tile) does.

        Parameters:
        tile - the destination tile
        Returns:
        the Chebyshev distance from the given tile
      • walkingDistance

        default double walkingDistance​(Tile tile)
        Walking distance based on pathfinding to the given tile.

        This is a more expensive call than distance(Tile), and should be used sparingly.

        Parameters:
        tile - the destination tile.
        Returns:
        return the path distance movement cost from the given tile as a double. If there isn't a path to the tile, it will return 3 times the as the crow flies distance.
      • canReach

        default boolean canReach()
        Checks if this location is reachable by the local player without obstacles
        Returns:
        true if it can, false otherwise
      • canReach

        default boolean canReach​(Tile tile)
        Checks if this location is reachable by the provided tile without obstacles
        Parameters:
        tile - target tile
        Returns:
        true if it can, false otherwise
      • getX

        default int getX()
        Gets X coordinate of the given object.
        Returns:
        the X coordinate of the object.
      • getY

        default int getY()
        Gets Y coordinate of the given object.
        Returns:
        the Y coordinate of the object.
      • getGridX

        default int getGridX()
        Gets grid (local) X coordinate of the given object.
        Returns:
        the grid X coordinate of the object.
      • getGridY

        default int getGridY()
        Gets grid (local) Y coordinate of the given object.
        Returns:
        the grid Y coordinate of the object.
      • getZ

        default int getZ()
        Gets Z coordinate of the given object.
        Returns:
        the Z coordinate of the object.
      • getTileReference

        default TileReference getTileReference()
        Gets tile reference of the given object.
        Returns:
        the object tile reference.