Enum Class Direction

java.lang.Object
java.lang.Enum<Direction>
com.sk89q.worldedit.util.Direction
All Implemented Interfaces:
Serializable, Comparable<Direction>, Constable

public enum Direction extends Enum<Direction>
A collection of cardinal, ordinal, and secondary-ordinal directions.
  • Enum Constant Details Link icon

    • NORTH Link icon

      public static final Direction NORTH
    • EAST Link icon

      public static final Direction EAST
    • SOUTH Link icon

      public static final Direction SOUTH
    • WEST Link icon

      public static final Direction WEST
    • UP Link icon

      public static final Direction UP
    • DOWN Link icon

      public static final Direction DOWN
    • NORTHEAST Link icon

      public static final Direction NORTHEAST
    • NORTHWEST Link icon

      public static final Direction NORTHWEST
    • SOUTHEAST Link icon

      public static final Direction SOUTHEAST
    • SOUTHWEST Link icon

      public static final Direction SOUTHWEST
    • WEST_NORTHWEST Link icon

      public static final Direction WEST_NORTHWEST
    • WEST_SOUTHWEST Link icon

      public static final Direction WEST_SOUTHWEST
    • NORTH_NORTHWEST Link icon

      public static final Direction NORTH_NORTHWEST
    • NORTH_NORTHEAST Link icon

      public static final Direction NORTH_NORTHEAST
    • EAST_NORTHEAST Link icon

      public static final Direction EAST_NORTHEAST
    • EAST_SOUTHEAST Link icon

      public static final Direction EAST_SOUTHEAST
    • SOUTH_SOUTHEAST Link icon

      public static final Direction SOUTH_SOUTHEAST
    • SOUTH_SOUTHWEST Link icon

      public static final Direction SOUTH_SOUTHWEST
    • ASCENDING_NORTH Link icon

      public static final Direction ASCENDING_NORTH
    • ASCENDING_EAST Link icon

      public static final Direction ASCENDING_EAST
    • ASCENDING_SOUTH Link icon

      public static final Direction ASCENDING_SOUTH
    • ASCENDING_WEST Link icon

      public static final Direction ASCENDING_WEST
  • Method Details Link icon

    • values Link icon

      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 Link icon

      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 Link icon

      public static Direction get(CharSequence sequence)
    • getLeft Link icon

      public Direction getLeft()
      Get the direction 90 degrees left (anti-clockwise) of this direction if possible, else return this direction
    • getRight Link icon

      public Direction getRight()
      Get the direction 90 degrees right (clockwise) of this direction if possible, else return this direction
    • getX Link icon

      public double getX()
    • getY Link icon

      public double getY()
    • getZ Link icon

      public double getZ()
    • getBlockX Link icon

      public int getBlockX()
    • getBlockY Link icon

      public int getBlockY()
    • getBlockZ Link icon

      public int getBlockZ()
    • isCardinal Link icon

      public boolean isCardinal()
      Return true if the direction is of a cardinal direction (north, west east, and south).

      This evaluates as false for directions that have a non-zero Y-component.

      Returns:
      true if cardinal
    • isOrdinal Link icon

      public boolean isOrdinal()
      Return true if the direction is of an ordinal direction (northwest, southwest, southeast, northeaast).
      Returns:
      true if ordinal
    • isSecondaryOrdinal Link icon

      public boolean isSecondaryOrdinal()
      Return true if the direction is of a secondary ordinal direction (north-northwest, north-northeast, south-southwest, etc.).
      Returns:
      true if secondary ordinal
    • isUpright Link icon

      public boolean isUpright()
      Return whether Y component is non-zero.
      Returns:
      true if the Y component is non-zero
    • toVector Link icon

      public Vector3 toVector()
      Get the vector.
      Returns:
      the vector
    • toBlockVector Link icon

      public BlockVector3 toBlockVector()
      Get the vector.
      Returns:
      the vector
    • findClosest Link icon

      @Nullable public static Direction findClosest(Vector3 vector, int flags)
      Find the closest direction to the given direction vector.
      Parameters:
      vector - the vector
      flags - the only flags that are permitted (use bitwise math)
      Returns:
      the closest direction, or null if no direction can be returned
    • valuesOf Link icon

      public static List<Direction> valuesOf(int flags)
      Gets all directions with the given flags.
      Parameters:
      flags - The flags
      Returns:
      The directions that fit the flags
    • fromRotationIndex Link icon

      public static Optional<Direction> fromRotationIndex(int rotation)
      Converts a rotation index into a Direction.

      Rotation indexes are used in BlockStates, such as sign posts.

      Parameters:
      rotation - The rotation index
      Returns:
      The direction, if applicable
    • toRotationIndex Link icon

      public OptionalInt toRotationIndex()
    • getDirections Link icon

      public static EnumSet<Direction> getDirections(BlockState state)
      Get the directions associated with the given block state, e.g. the connections a fence makes or the direction stairs face
      Since:
      2.12.3