Package cn.nukkit.math
Enum Class BlockFace
- All Implemented Interfaces:
Serializable
,Comparable<BlockFace>
,Constable
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic enum
static enum
static enum
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>>
-
Enum Constant Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic BlockFace
fromAxis
(BlockFace.AxisDirection axisDirection, BlockFace.Axis axis) static BlockFace
fromHorizontalAngle
(double angle) Get the BlockFace corresponding to the given angle (0-360).static BlockFace
fromHorizontalIndex
(int index) Get a BlockFace by it's horizontal index (0-3).static BlockFace
fromIndex
(int index) Get a BlockFace by it's index (0-5).getAxis()
Get the Axis of this BlockFaceGet the AxisDirection of this BlockFaceint
Get the index of this BlockFace (0-5).int
Get the index of this BlockFace (0-5).getEdges()
float
Get the angle of this BlockFace (0-360)int
Get the horizontal index of this BlockFace (0-3).static BlockFace[]
int
getIndex()
Get the index of this BlockFace (0-5).getName()
Get the name of this BlockFace (up, down, north, etc.)Get the opposite BlockFace (e.g.Get the unit vector of this BlockFaceint
Returns an offset that addresses the block in front of this BlockFaceint
Returns an offset that addresses the block in front of this BlockFaceint
Returns an offset that addresses the block in front of this BlockFacestatic BlockFace
Choose a random BlockFace using the given RandomrotateY()
Rotate this BlockFace around the Y axis clockwise (NORTH => EAST => SOUTH => WEST => NORTH)Rotate this BlockFace around the Y axis counter-clockwise (NORTH => WEST => SOUTH => EAST => NORTH)toString()
static BlockFace
Returns the enum constant of this class with the specified name.static BlockFace[]
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
-
getHorizontals
-
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
-
getDUNESWIndex
Get the index of this BlockFace (0-5). The order is D-U-N-E-S-W- Returns:
- index
-
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
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
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
Get the opposite BlockFace (e.g. DOWN ==> UP)- Returns:
- block face
-
rotateY
Rotate this BlockFace around the Y axis clockwise (NORTH => EAST => SOUTH => WEST => NORTH)- Returns:
- block face
-
rotateYCCW
Rotate this BlockFace around the Y axis counter-clockwise (NORTH => WEST => SOUTH => EAST => NORTH)- Returns:
- block face
-
getCompassRoseDirection
-
getEdges
-
toString
-