Enum Class BlockFace

java.lang.Object
java.lang.Enum<BlockFace>
nl.pim16aap2.animatedarchitecture.core.util.BlockFace
All Implemented Interfaces:
Serializable, Comparable<BlockFace>, Constable

public enum BlockFace extends Enum<BlockFace>
Represents the 6 faces of a cube.
  • 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
    • getOpposite

      public static BlockFace getOpposite(BlockFace dir)
      Get the BlockFace that's the exact opposite of the provided one. For example, the opposite side of UP is DOWN.
      Parameters:
      dir - The current BlockFace
      Returns:
      The opposite direction of the current BlockFace.
    • getValue

      public static int getValue(BlockFace dir)
      Gets the integer value of a BlockFace.
      Parameters:
      dir - The BlockFace.
      Returns:
      The integer value of a BlockFace.
    • valueOf

      public static BlockFace valueOf(int val)
      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:
      val - 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
    • getDirection

      public static Vector3Di getDirection(BlockFace myFace)
      Get the directionVector of this BlockFace
      Parameters:
      myFace - The direction.
      Returns:
      The vector of the direction.
    • rotateClockwise

      public static BlockFace rotateClockwise(BlockFace myFace)
      Rotate the BlockFace in clockwise direction from a perspective of looking down on the world. For example, NORTH would return EAST.
      Parameters:
      myFace - The current BlockFace.
      Returns:
      The rotated BlockFace.
    • rotateCounterClockwise

      public static BlockFace rotateCounterClockwise(BlockFace myFace)
      Rotate the BlockFace in counterclockwise direction from a perspective of looking down on the world. For example, NORTH would return WEST.
      Parameters:
      myFace - The current BlockFace.
      Returns:
      The rotated BlockFace.
    • rotateVerticallyNorth

      public static BlockFace rotateVerticallyNorth(BlockFace curFace)
      Rotate the BlockFace in northern direction on the vertical plane. For example, UP would return NORTH and NORTH would return DOWN.
      Parameters:
      curFace - The current BlockFace.
      Returns:
      The rotated BlockFace.
    • rotateVerticallySouth

      public static BlockFace rotateVerticallySouth(BlockFace curFace)
      Rotate the BlockFace in southern direction on the vertical plane. For example, UP would return SOUTH and SOUTH would return DOWN.
      Parameters:
      curFace - The current BlockFace.
      Returns:
      The rotated BlockFace.
    • rotateVerticallyEast

      public static BlockFace rotateVerticallyEast(BlockFace curFace)
      Rotate the BlockFace in eastern direction on the vertical plane. For example, UP would return EAST and EAST would return DOWN.
      Parameters:
      curFace - The current BlockFace.
      Returns:
      The rotated BlockFace.
    • rotateVerticallyWest

      public static BlockFace rotateVerticallyWest(BlockFace curFace)
      Rotate the BlockFace in western direction on the vertical plane. For example, UP would return WEST and WEST would return DOWN.
      Parameters:
      curFace - The current BlockFace.
      Returns:
      The rotated BlockFace.
    • faceFromDir

      public static Optional<BlockFace> faceFromDir(Vector3Di dir)
      Get the blockFace from a directionVector value.
      Parameters:
      dir - The directionVector.
      Returns:
      The BlockFace associated with this directionVector.
    • getRotationFunction

      public static @Nullable UnaryOperator<BlockFace> getRotationFunction(MovementDirection movementDirection)
      Get the appropriate function for rotating a BlockFace. Different rotation directions use different methods.
      Parameters:
      movementDirection - The MovementDirection to rotate in.
      Returns:
      The appropriate function for rotating the BlockFace in the given direction.
    • rotate

      public static BlockFace rotate(BlockFace blockFace, int steps, @Nullable UnaryOperator<BlockFace> rotationFunction)
      Rotate a block face in a given direction for a number of steps.
      Parameters:
      blockFace - The BlockFace that will be rotated.
      steps - The number of times to apply the rotation.
      rotationFunction - The function the applies the rotation.
      Returns:
      The rotated BlockFace.
      See Also:
    • rotate

      public static BlockFace rotate(BlockFace blockFace, int steps, MovementDirection direction)
      Rotate a block face in a given direction for a number of steps.
      Parameters:
      blockFace - The BlockFace that will be rotated.
      steps - The number of times to apply the rotation.
      direction - The direction to rotate in.
      Returns:
      The rotated BlockFace.