Enum Class Direction

java.lang.Object
java.lang.Enum<Direction>
org.cloudburstmc.api.util.Direction
All Implemented Interfaces:
Serializable, Comparable<Direction>, Constable

public enum Direction extends Enum<Direction>
  • Enum Constant Details

  • 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
    • fromIndex

      public static Direction fromIndex(int index)
      Get a BlockFace by it's index (0-5). The order is D-U-N-S-W-E
      Parameters:
      index - BlockFace index
      Returns:
      block face
    • fromHorizontalIndex

      public static Direction fromHorizontalIndex(int index)
      Get a BlockFace by it's horizontal index (0-3). The order is S-W-N-E
      Parameters:
      index - BlockFace index
      Returns:
      block face
    • fromHorizontalAngle

      public static Direction fromHorizontalAngle(double angle)
      Get the BlockFace corresponding to the given angle (0-360). An angle of 0 is SOUTH, an angle of 90 would be WEST
      Parameters:
      angle - horizontal angle
      Returns:
      block face
    • fromAxis

      public static Direction fromAxis(Direction.AxisDirection axisDirection, Direction.Axis axis)
    • random

      public static Direction random(Random rand)
      Choose a random BlockFace using the given Random
      Parameters:
      rand - random number generator
      Returns:
      block face
    • getIndex

      public int getIndex()
      Get the index of this BlockFace (0-5). The order is D-U-N-S-W-E
      Returns:
      index
    • getHorizontalIndex

      public int getHorizontalIndex()
      Get the horizontal index of this BlockFace (0-3). The order is S-W-N-E
      Returns:
      horizontal index
    • getCardinalDirection

      public CardinalDirection getCardinalDirection()
    • getHorizontalAngle

      public float getHorizontalAngle()
      Get the angle of this BlockFace (0-360)
      Returns:
      horizontal angle
    • getName

      public String getName()
      Get the name of this BlockFace (up, down, north, etc.)
      Returns:
      name
    • getAxis

      public Direction.Axis getAxis()
      Get the Axis of this BlockFace
      Returns:
      axis
    • getAxisDirection

      public Direction.AxisDirection getAxisDirection()
      Get the AxisDirection of this BlockFace
      Returns:
      axis direction
    • getUnitVector

      public com.nukkitx.math.vector.Vector3i getUnitVector()
      Get the unit vector of this BlockFace
      Returns:
      vector
    • getOffset

      public com.nukkitx.math.vector.Vector3i getOffset(com.nukkitx.math.vector.Vector3i pos)
    • getOffset

      public com.nukkitx.math.vector.Vector3i getOffset(com.nukkitx.math.vector.Vector3i pos, int step)
    • getXOffset

      public int getXOffset()
      Returns an offset that addresses the block in front of this BlockFace
      Returns:
      x offset
    • getYOffset

      public int getYOffset()
      Returns an offset that addresses the block in front of this BlockFace
      Returns:
      y offset
    • getZOffset

      public int getZOffset()
      Returns an offset that addresses the block in front of this BlockFace
      Returns:
      x offset
    • getOpposite

      public Direction getOpposite()
      Get the opposite BlockFace (e.g. DOWN ==> UP)
      Returns:
      block face
    • rotateY

      public Direction rotateY()
      Rotate this BlockFace around the Y axis clockwise (NORTH => EAST => SOUTH => WEST => BB_NORTH)
      Returns:
      block face
    • rotateYCCW

      public Direction rotateYCCW()
      Rotate this BlockFace around the Y axis counter-clockwise (NORTH => WEST => SOUTH => EAST => BB_NORTH)
      Returns:
      block face
    • toString

      public String toString()
      Overrides:
      toString in class Enum<Direction>