Package net.minecraft.util.math
Enum Direction
- All Implemented Interfaces:
Serializable
,Comparable<Direction>
,java.lang.constant.Constable
,StringIdentifiable
public enum Direction extends Enum<Direction> implements StringIdentifiable
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Direction.Axis
static class
Direction.AxisDirection
static class
Direction.Type
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>>
-
Enum Constant Summary
-
Field Summary
Fields Modifier and Type Field Description private static Direction[]
ALL
private Direction.Axis
axis
private Direction.AxisDirection
direction
private static Direction[]
HORIZONTAL
private int
id
private int
idHorizontal
private int
idOpposite
private String
name
private static Map<String,Direction>
NAME_MAP
private static Direction[]
VALUES
private Vec3i
vector
private static Long2ObjectMap<Direction>
VECTOR_TO_DIRECTION
-
Constructor Summary
Constructors Modifier Constructor Description private
Direction(int id, int idOpposite, int idHorizontal, String name, Direction.AxisDirection direction, Direction.Axis axis, Vec3i vector)
-
Method Summary
Modifier and Type Method Description float
asRotation()
String
asString()
static Direction
byId(int id)
static Direction
byName(String name)
static Direction
from(Direction.Axis axis, Direction.AxisDirection direction)
static Direction
fromHorizontal(int value)
static Direction
fromRotation(double rotation)
static Direction
fromVector(int x, int y, int z)
static Direction
get(Direction.AxisDirection direction, Direction.Axis axis)
Direction.Axis
getAxis()
Direction.AxisDirection
getDirection()
static Direction[]
getEntityFacingOrder(Entity entity)
static Direction
getFacing(double x, double y, double z)
static Direction
getFacing(float x, float y, float z)
int
getHorizontal()
int
getId()
String
getName()
int
getOffsetX()
int
getOffsetY()
int
getOffsetZ()
Direction
getOpposite()
Quaternion
getRotationQuaternion()
Vector3f
getUnitVector()
Vec3i
getVector()
private static Direction[]
listClosest(Direction first, Direction second, Direction third)
Helper function that returns the 3 directions given, followed by the 3 opposite given in opposite order.boolean
method_30928(float float2)
static Direction
random(Random random)
Direction
rotateYClockwise()
Direction
rotateYCounterclockwise()
String
toString()
static Direction
transform(Matrix4f matrix, Direction direction)
static Direction
valueOf(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.
-
Enum Constant Details
-
DOWN
-
UP
-
NORTH
-
SOUTH
-
WEST
-
EAST
-
-
Field Details
-
ALL
-
NAME_MAP
-
VALUES
-
HORIZONTAL
-
VECTOR_TO_DIRECTION
-
id
private final int id -
idOpposite
private final int idOpposite -
idHorizontal
private final int idHorizontal -
name
-
axis
-
direction
-
vector
-
-
Constructor Details
-
Direction
private Direction(int id, int idOpposite, int idHorizontal, String name, Direction.AxisDirection direction, Direction.Axis axis, Vec3i vector)
-
-
Method Details
-
values
Returns an array containing the constants of this enum type, in the order they are declared.- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (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 type has no constant with the specified nameNullPointerException
- if the argument is null
-
getEntityFacingOrder
-
listClosest
Helper function that returns the 3 directions given, followed by the 3 opposite given in opposite order. -
transform
-
getRotationQuaternion
-
getId
public int getId() -
getHorizontal
public int getHorizontal() -
getDirection
-
getOpposite
-
rotateYClockwise
-
rotateYCounterclockwise
-
getOffsetX
public int getOffsetX() -
getOffsetY
public int getOffsetY() -
getOffsetZ
public int getOffsetZ() -
getUnitVector
-
getName
-
getAxis
-
byName
-
byId
-
fromHorizontal
-
fromVector
-
fromRotation
-
from
-
asRotation
public float asRotation() -
random
-
getFacing
-
getFacing
-
toString
-
asString
- Specified by:
asString
in interfaceStringIdentifiable
-
get
-
getVector
-
method_30928
public boolean method_30928(float float2)
-