Package com.sk89q.worldedit.util
Enum Class Direction
- All Implemented Interfaces:
Serializable
,Comparable<Direction>
,Constable
A collection of cardinal, ordinal, and secondary-ordinal directions.
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>>
-
Enum Constant Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic Direction
findClosest
(Vector3 vector, int flags) Find the closest direction to the given direction vector.fromRotationIndex
(int rotation) Converts a rotation index into a Direction.static Direction
get
(CharSequence sequence) int
int
int
getLeft()
getRight()
double
getX()
double
getY()
double
getZ()
boolean
Return true if the direction is of a cardinal direction (north, west east, and south).boolean
Return true if the direction is of an ordinal direction (northwest, southwest, southeast, northeaast).boolean
Return true if the direction is of a secondary ordinal direction (north-northwest, north-northeast, south-southwest, etc.).boolean
Return whether Y component is non-zero.Get the vector.toVector()
Get the vector.static Direction
Returns 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.valuesOf
(int flags) Gets all directions with the given flags.
-
Enum Constant Details
-
NORTH
-
EAST
-
SOUTH
-
WEST
-
UP
-
DOWN
-
NORTHEAST
-
NORTHWEST
-
SOUTHEAST
-
SOUTHWEST
-
WEST_NORTHWEST
-
WEST_SOUTHWEST
-
NORTH_NORTHWEST
-
NORTH_NORTHEAST
-
EAST_NORTHEAST
-
EAST_SOUTHEAST
-
SOUTH_SOUTHEAST
-
SOUTH_SOUTHWEST
-
ASCENDING_NORTH
-
ASCENDING_EAST
-
ASCENDING_SOUTH
-
ASCENDING_WEST
-
-
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
-
get
-
getLeft
-
getRight
-
getX
public double getX() -
getY
public double getY() -
getZ
public double getZ() -
getBlockX
public int getBlockX() -
getBlockY
public int getBlockY() -
getBlockZ
public int getBlockZ() -
isCardinal
public boolean isCardinal()Return true if the direction is of a cardinal direction (north, west east, and south).This evaluates as false for directions that have a non-zero Y-component.
- Returns:
- true if cardinal
-
isOrdinal
public boolean isOrdinal()Return true if the direction is of an ordinal direction (northwest, southwest, southeast, northeaast).- Returns:
- true if ordinal
-
isSecondaryOrdinal
public boolean isSecondaryOrdinal()Return true if the direction is of a secondary ordinal direction (north-northwest, north-northeast, south-southwest, etc.).- Returns:
- true if secondary ordinal
-
isUpright
public boolean isUpright()Return whether Y component is non-zero.- Returns:
- true if the Y component is non-zero
-
toVector
Get the vector.- Returns:
- the vector
-
toBlockVector
Get the vector.- Returns:
- the vector
-
findClosest
Find the closest direction to the given direction vector.- Parameters:
vector
- the vectorflags
- the only flags that are permitted (use bitwise math)- Returns:
- the closest direction, or null if no direction can be returned
-
valuesOf
Gets all directions with the given flags.- Parameters:
flags
- The flags- Returns:
- The directions that fit the flags
-
fromRotationIndex
Converts a rotation index into a Direction.Rotation indexes are used in BlockStates, such as sign posts.
- Parameters:
rotation
- The rotation index- Returns:
- The direction, if applicable
-
toRotationIndex
-