Enum Class Direction

java.lang.Object
java.lang.Enum<Direction>
com.epicbot.api.shared.model.Direction
All Implemented Interfaces:
Serializable, Comparable<Direction>, Constable

public enum Direction extends Enum<Direction>
Represents the four main cardinal points.

Angles are represented as an int value ranging from 0-2047, where the following is true:

  • 0 or 2048 is true South
  • 256 is true South-West
  • 512 is true West
  • 768 is true North-West
  • 1024 is true North
  • 1280 is true North-East
  • 1536 is true East
  • 1792 is true South-East
  • Enum Constant Details

    • SOUTH

      public static final Direction SOUTH
      Angles ranging from 0 - 127 and 1920 - 2047.
    • SOUTH_WEST

      public static final Direction SOUTH_WEST
      Angles ranging from 128 - 383.
    • WEST

      public static final Direction WEST
      Angles ranging from 384 - 639.
    • NORTH_WEST

      public static final Direction NORTH_WEST
      Angles ranging from 640 - 895.
    • NORTH

      public static final Direction NORTH
      Angles ranging from 896 - 1151.
    • NORTH_EAST

      public static final Direction NORTH_EAST
      Angles ranging from 1152 - 1407.
    • EAST

      public static final Direction EAST
      Angles ranging from 1408 - 1663.
    • SOUTH_EAST

      public static final Direction SOUTH_EAST
      Angles ranging from 1664 - 1919.
  • Method Details

    • values

      public static Direction[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static Direction valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • get

      public static Direction get(int angle)
      Converts the angle value to the nearest cardinal direction.

      Each cardinal direction contains 256 angles, ranging between -128 and +128 of it's true value. Negative values and values above 2047 are wrapped accordingly

      Parameters:
      angle - the RS angle
      Returns:
      Nearest cardinal direction to the angle
    • getAngleTo

      public static int getAngleTo(Locatable origin, Locatable locatable)
    • getAngleToDeg

      public static int getAngleToDeg(Locatable origin, Locatable locatable)
    • getDirectionTo

      public static Direction getDirectionTo(Locatable origin, Locatable locatable)
    • toRS

      public static int toRS(int degrees)
    • toDegrees

      public static int toDegrees(int angle)