Modifier and Type | Class and Description |
---|---|
static class |
Direction.Flag
Flags to use with
findClosest(Vector3, int) . |
Enum Constant and Description |
---|
DOWN |
EAST |
EAST_NORTHEAST |
EAST_SOUTHEAST |
NORTH |
NORTH_NORTHEAST |
NORTH_NORTHWEST |
NORTHEAST |
NORTHWEST |
SOUTH |
SOUTH_SOUTHEAST |
SOUTH_SOUTHWEST |
SOUTHEAST |
SOUTHWEST |
UP |
WEST |
WEST_NORTHWEST |
WEST_SOUTHWEST |
Modifier and Type | Method and Description |
---|---|
static Direction |
findClosest(Vector3 vector,
int flags)
Find the closest direction to the given direction vector.
|
static java.util.Optional<Direction> |
fromRotationIndex(int rotation)
Converts a rotation index into a Direction.
|
boolean |
isCardinal()
Return true if the direction is of a cardinal direction (north, west
east, and south).
|
boolean |
isOrdinal()
Return true if the direction is of an ordinal direction (northwest,
southwest, southeast, northeaast).
|
boolean |
isSecondaryOrdinal()
Return true if the direction is of a secondary ordinal direction
(north-northwest, north-northeast, south-southwest, etc.).
|
boolean |
isUpright()
Return whether Y component is non-zero.
|
BlockVector3 |
toBlockVector()
Get the vector.
|
java.util.OptionalInt |
toRotationIndex() |
Vector3 |
toVector()
Get the vector.
|
static Direction |
valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name.
|
static Direction[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
static java.util.List<Direction> |
valuesOf(int flags)
Gets all directions with the given flags.
|
public static final Direction NORTH
public static final Direction EAST
public static final Direction SOUTH
public static final Direction WEST
public static final Direction UP
public static final Direction DOWN
public static final Direction NORTHEAST
public static final Direction NORTHWEST
public static final Direction SOUTHEAST
public static final Direction SOUTHWEST
public static final Direction WEST_NORTHWEST
public static final Direction WEST_SOUTHWEST
public static final Direction NORTH_NORTHWEST
public static final Direction NORTH_NORTHEAST
public static final Direction EAST_NORTHEAST
public static final Direction EAST_SOUTHEAST
public static final Direction SOUTH_SOUTHEAST
public static final Direction SOUTH_SOUTHWEST
public static Direction[] values()
for (Direction c : Direction.values()) System.out.println(c);
public static Direction valueOf(java.lang.String name)
name
- the name of the enum constant to be returned.java.lang.IllegalArgumentException
- if this enum type has no constant with the specified namejava.lang.NullPointerException
- if the argument is nullpublic boolean isCardinal()
This evaluates as false for directions that have a non-zero Y-component.
public boolean isOrdinal()
public boolean isSecondaryOrdinal()
public boolean isUpright()
public Vector3 toVector()
public BlockVector3 toBlockVector()
@Nullable public static Direction findClosest(Vector3 vector, int flags)
vector
- the vectorflags
- the only flags that are permitted (use bitwise math)public static java.util.List<Direction> valuesOf(int flags)
flags
- The flagspublic static java.util.Optional<Direction> fromRotationIndex(int rotation)
Rotation indexes are used in BlockStates, such as sign posts.
rotation
- The rotation indexpublic java.util.OptionalInt toRotationIndex()