- All Implemented Interfaces:
Serializable,Comparable<Direction>,Constable
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumstatic enumstatic enumNested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum Constants -
Method Summary
Modifier and TypeMethodDescriptionstatic DirectionfromAxis(Direction.AxisDirection axisDirection, Direction.Axis axis) static DirectionfromHorizontalAngle(double angle) Get the BlockFace corresponding to the given angle (0-360).static DirectionfromHorizontalIndex(int index) Get a BlockFace by it's horizontal index (0-3).static DirectionfromIndex(int index) Get a BlockFace by it's index (0-5).getAxis()Get the Axis of this BlockFaceGet the AxisDirection of this BlockFacefloatGet the angle of this BlockFace (0-360)intGet the horizontal index of this BlockFace (0-3).intgetIndex()Get the index of this BlockFace (0-5).getName()Get the name of this BlockFace (up, down, north, etc.)com.nukkitx.math.vector.Vector3igetOffset(com.nukkitx.math.vector.Vector3i pos) com.nukkitx.math.vector.Vector3igetOffset(com.nukkitx.math.vector.Vector3i pos, int step) Get the opposite BlockFace (e.g.com.nukkitx.math.vector.Vector3iGet the unit vector of this BlockFaceintReturns an offset that addresses the block in front of this BlockFaceintReturns an offset that addresses the block in front of this BlockFaceintReturns an offset that addresses the block in front of this BlockFacestatic DirectionChoose a random BlockFace using the given RandomrotateY()Rotate this BlockFace around the Y axis clockwise (NORTH => EAST => SOUTH => WEST => BB_NORTH)Rotate this BlockFace around the Y axis counter-clockwise (NORTH => WEST => SOUTH => EAST => BB_NORTH)toString()static DirectionReturns the enum constant of this class with the specified name.static Direction[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
DOWN
-
UP
-
NORTH
-
SOUTH
-
WEST
-
EAST
-
-
Method Details
-
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
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 nameNullPointerException- if the argument is null
-
fromIndex
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
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
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
-
random
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
-
getHorizontalAngle
public float getHorizontalAngle()Get the angle of this BlockFace (0-360)- Returns:
- horizontal angle
-
getName
Get the name of this BlockFace (up, down, north, etc.)- Returns:
- name
-
getAxis
Get the Axis of this BlockFace- Returns:
- axis
-
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
Get the opposite BlockFace (e.g. DOWN ==> UP)- Returns:
- block face
-
rotateY
Rotate this BlockFace around the Y axis clockwise (NORTH => EAST => SOUTH => WEST => BB_NORTH)- Returns:
- block face
-
rotateYCCW
Rotate this BlockFace around the Y axis counter-clockwise (NORTH => WEST => SOUTH => EAST => BB_NORTH)- Returns:
- block face
-
toString
-