Interface TileObject

    • Field Summary

      Fields 
      Modifier and Type Field Description
      static int HASH_PLANE_SHIFT  
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      Point getCanvasLocation()
      Calculates the position of the center of this tile on the canvas
      Point getCanvasLocation​(int zOffset)
      Calculates the position of the center of this tile on the canvas
      Point getCanvasTextLocation​(java.awt.Graphics2D graphics, java.lang.String text, int zOffset)
      Calculates the canvas point to center text above the tile this object is on.
      java.awt.Polygon getCanvasTilePoly()
      Creates a polygon outlining the tile this object is on
      java.awt.Shape getClickbox()
      Calculate the on-screen clickable area of the object.
      long getHash()
      A bitfield containing various flags:
      int getId()
      Gets the ID of the object.
      LocalPoint getLocalLocation()
      Get the local location for this object.
      Point getMinimapLocation()
      Gets a point on the canvas of where this objects mini-map indicator should appear.
      int getPlane()
      Gets the plane of the tile that the object is on.
      WorldPoint getWorldLocation()
      Get the world location for this object.
      WorldView getWorldView()
      Gets the WorldView this TileObject is a part of.
      int getX()
      Gets the x-axis coordinate of the object in local context.
      int getY()
      Gets the y-axis coordinate of the object in local context.
      int getZ()
      Gets the vertical coordinate of this object
    • Method Detail

      • getHash

        long getHash()
        A bitfield containing various flags:
        
         worldView = bits >> 52 & 4095
         id = bits >> 20 & 0xffffffff
         wall = bits >> 19 & 1
         type = bits >> 16 & 7
         plane = bits >> 14 & 3
         scene y = bits >> 7 & 127
         scene x = bits >> 0 & 127
         
        Type 0 = player, 1 = npc, 2 = game object, 3 = item, 4 = world entity
      • getX

        int getX()
        Gets the x-axis coordinate of the object in local context.
        See Also:
        LocalPoint
      • getY

        int getY()
        Gets the y-axis coordinate of the object in local context.
        See Also:
        LocalPoint
      • getZ

        int getZ()
        Gets the vertical coordinate of this object
      • getPlane

        int getPlane()
        Gets the plane of the tile that the object is on.
      • getWorldView

        WorldView getWorldView()
        Gets the WorldView this TileObject is a part of.
      • getId

        int getId()
        Gets the ID of the object.
        See Also:
        ObjectID
      • getWorldLocation

        @Nonnull
        WorldPoint getWorldLocation()
        Get the world location for this object. For objects which are larger than 1 tile, this is the center most tile, rounded to the south-west.
        Returns:
      • getLocalLocation

        @Nonnull
        LocalPoint getLocalLocation()
        Get the local location for this object. This point is the center point of the object.
        Returns:
      • getCanvasLocation

        @Nullable
        Point getCanvasLocation()
        Calculates the position of the center of this tile on the canvas
      • getCanvasLocation

        @Nullable
        Point getCanvasLocation​(int zOffset)
        Calculates the position of the center of this tile on the canvas
        Parameters:
        zOffset - Vertical offset to apply before projection
      • getCanvasTilePoly

        @Nullable
        java.awt.Polygon getCanvasTilePoly()
        Creates a polygon outlining the tile this object is on
      • getCanvasTextLocation

        @Nullable
        Point getCanvasTextLocation​(java.awt.Graphics2D graphics,
                                    java.lang.String text,
                                    int zOffset)
        Calculates the canvas point to center text above the tile this object is on.
        Parameters:
        graphics - the graphics to use for font size calculation
        zOffset - Vertical offset to apply before projection
        Returns:
        the canvas point to draw the text at
      • getMinimapLocation

        @Nullable
        Point getMinimapLocation()
        Gets a point on the canvas of where this objects mini-map indicator should appear.
        Returns:
        mini-map location on canvas
      • getClickbox

        @Nullable
        java.awt.Shape getClickbox()
        Calculate the on-screen clickable area of the object.