Enum Class BlockFace

java.lang.Object
java.lang.Enum<BlockFace>
cn.nukkit.math.BlockFace
All Implemented Interfaces:
Serializable, Comparable<BlockFace>, Constable

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

  • Method Details

    • values

      public static BlockFace[] 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 BlockFace 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
    • getHorizontals

      public static BlockFace[] getHorizontals()
    • fromIndex

      public static BlockFace 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 BlockFace 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 BlockFace 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 BlockFace fromAxis(BlockFace.AxisDirection axisDirection, BlockFace.Axis axis)
    • random

      public static BlockFace 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
    • getDUNESWIndex

      @PowerNukkitXOnly @Since("1.6.0.0-PNX") public int getDUNESWIndex()
      Get the index of this BlockFace (0-5). The order is D-U-N-E-S-W
      Returns:
      index
    • getDUSWNEIndex

      @PowerNukkitXOnly @Since("1.6.0.0-PNX") public int getDUSWNEIndex()
      Get the index of this BlockFace (0-5). The order is D-U-S-W-N-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
    • 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 BlockFace.Axis getAxis()
      Get the Axis of this BlockFace
      Returns:
      axis
    • getAxisDirection

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

      public Vector3 getUnitVector()
      Get the unit vector of this BlockFace
      Returns:
      vector
    • 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 BlockFace getOpposite()
      Get the opposite BlockFace (e.g. DOWN ==> UP)
      Returns:
      block face
    • rotateY

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

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

      @PowerNukkitOnly @Since("1.4.0.0-PN") public CompassRoseDirection getCompassRoseDirection()
    • getEdges

      @Since("FUTURE") @PowerNukkitOnly public Set<BlockFace> getEdges()
    • toString

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