Class WorldPointService


  • public class WorldPointService
    extends java.lang.Object
    A utility class for compressing and decompressing WorldPoint objects into and from integers.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static int dx​(int packed, int offset)
      Offsets the compressed WorldPoint by the given amounts in each dimension.
      static int dxy​(int packed, int offsetX, int offsetY)
      Offsets the compressed WorldPoint by the given amounts in each dimension.
      static int dy​(int packed, int offset)
      Offsets the compressed WorldPoint by the given amounts in each dimension.
      static net.runelite.api.coords.WorldPoint fromPacked​(int packed)
      Decompresses a compressed WorldPoint integer back into a WorldPoint.
      static byte getPackedPlane​(int packed)
      Extracts the plane from a compressed WorldPoint integer.
      static short getPackedX​(int packed)
      Extracts the X coordinate from a compressed WorldPoint integer.
      static short getPackedY​(int packed)
      Extracts the Y coordinate from a compressed WorldPoint integer.
      static int pack​(int x, int y, int z)
      Compresses x, y, z coordinates into a single integer.
      static int pack​(net.runelite.api.coords.WorldPoint wp)
      Compresses a WorldPoint into a single integer.
      static net.runelite.api.coords.WorldPoint unpack​(int packed)
      Overloaded method wrapping fromPacked.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • WorldPointService

        public WorldPointService()
    • Method Detail

      • pack

        public static int pack​(net.runelite.api.coords.WorldPoint wp)
        Compresses a WorldPoint into a single integer.
        Parameters:
        wp - the WorldPoint to compress
        Returns:
        the compressed WorldPoint
      • pack

        public static int pack​(int x,
                               int y,
                               int z)
        Compresses x, y, z coordinates into a single integer.
        Parameters:
        x - the x coordinate (0 - 16383)
        y - the y coordinate (0 - 32767)
        z - the z coordinate (0 - 7)
        Returns:
        the compressed coordinates
      • fromPacked

        public static net.runelite.api.coords.WorldPoint fromPacked​(int packed)
        Decompresses a compressed WorldPoint integer back into a WorldPoint.
        Parameters:
        packed - the packed WorldPoint
        Returns:
        the unpacked WorldPoint
      • unpack

        public static net.runelite.api.coords.WorldPoint unpack​(int packed)
        Overloaded method wrapping fromPacked.
        Parameters:
        packed - The compressed WorldPoint
        Returns:
        the unpacked WorldPoint
      • getPackedX

        public static short getPackedX​(int packed)
        Extracts the X coordinate from a compressed WorldPoint integer.
        Parameters:
        packed - the compressed WorldPoint
        Returns:
        the X coordinate
      • getPackedY

        public static short getPackedY​(int packed)
        Extracts the Y coordinate from a compressed WorldPoint integer.
        Parameters:
        packed - the compressed WorldPoint
        Returns:
        the Y coordinate
      • getPackedPlane

        public static byte getPackedPlane​(int packed)
        Extracts the plane from a compressed WorldPoint integer.
        Parameters:
        packed - the compressed WorldPoint
        Returns:
        the plane
      • dx

        public static int dx​(int packed,
                             int offset)
        Offsets the compressed WorldPoint by the given amounts in each dimension.
        Parameters:
        packed - the compressed WorldPoint
        offset - the amount to offset in the X direction
        Returns:
        the new compressed WorldPoint
      • dy

        public static int dy​(int packed,
                             int offset)
        Offsets the compressed WorldPoint by the given amounts in each dimension.
        Parameters:
        packed - the compressed WorldPoint
        offset - the amount to offset in the Y direction
        Returns:
        the new compressed WorldPoint
      • dxy

        public static int dxy​(int packed,
                              int offsetX,
                              int offsetY)
        Offsets the compressed WorldPoint by the given amounts in each dimension.
        Parameters:
        packed - the compressed WorldPoint
        offsetX - the amount to offset in the X direction
        offsetY - the amount to offset in the Y direction
        Returns:
        the new compressed WorldPoint