Package net.minecraft.core
Enum Class Direction
- All Implemented Interfaces:
Serializable
,Comparable<Direction>
,Constable
,StringRepresentable
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enum
static enum
static enum
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>>
Nested classes/interfaces inherited from interface net.minecraft.util.StringRepresentable
StringRepresentable.EnumCodec<E extends Enum<E> & StringRepresentable>, StringRepresentable.StringRepresentableCodec<S extends StringRepresentable>
-
Enum Constant Summary
Enum Constants -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Direction.Axis
private final Direction.AxisDirection
private static final Direction[]
All Facings with horizontal axis in order S-W-N-Eprivate static final Direction[]
static final IntFunction
<Direction> static final StringRepresentable.EnumCodec
<Direction> private final int
Ordering index for the HORIZONTALS field (S-W-N-E)private final int
Ordering index for D-U-N-S-W-Eprivate final String
private final Vec3i
Normalized vector that points in the direction of this Directionprivate final int
Index of the opposite Direction in the VALUES arraystatic final StreamCodec
<io.netty.buffer.ByteBuf, Direction> private static final Direction[]
static final com.mojang.serialization.Codec
<Direction> Fields inherited from interface net.minecraft.util.StringRepresentable
PRE_BUILT_MAP_THRESHOLD
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprivate
Direction
(int pData3d, int pOppositeIndex, int pData2d, String pName, Direction.AxisDirection pAxisDirection, Direction.Axis pAxis, Vec3i pNormal) -
Method Summary
Modifier and TypeMethodDescriptionstatic Collection
<Direction> allShuffled
(RandomSource pRandom) static Direction
static Direction
from2DDataValue
(int pHorizontalIndex) static Direction
from3DDataValue
(int pIndex) static Direction
fromAxisAndDirection
(Direction.Axis pAxis, Direction.AxisDirection pAxisDirection) static Direction
fromDelta
(int pX, int pY, int pZ) static Direction
fromYRot
(double pAngle) static Direction
get
(Direction.AxisDirection pAxisDirection, Direction.Axis pAxis) int
int
getAxis()
getClockWise
(Direction.Axis pAxis) private Direction
private Direction
private Direction
private Direction
static Direction
getFacingAxis
(Entity pEntity, Direction.Axis pAxis) getName()
static Direction
getNearest
(double pX, double pY, double pZ) static Direction
getNearest
(float pX, float pY, float pZ) static Direction
getNearest
(Vec3 pOis) static Direction
getRandom
(RandomSource pRandom) org.joml.Quaternionf
int
getStepX()
int
getStepY()
int
getStepZ()
boolean
isFacingAngle
(float pDegrees) private static Direction[]
makeDirectionArray
(Direction pFirst, Direction pSecond, Direction pThird) static Direction[]
orderedByNearest
(Entity pEntity) Gets theDirection
values for the provided entity's looking direction.static Direction
org.joml.Vector3f
step()
stream()
toString()
float
toYRot()
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.private static com.mojang.serialization.DataResult
<Direction> verifyVertical
(Direction p_194529_)
-
Enum Constant Details
-
DOWN
-
UP
-
NORTH
-
SOUTH
-
WEST
-
EAST
-
-
Field Details
-
CODEC
-
VERTICAL_CODEC
-
BY_ID
-
STREAM_CODEC
-
data3d
private final int data3dOrdering index for D-U-N-S-W-E -
oppositeIndex
private final int oppositeIndexIndex of the opposite Direction in the VALUES array -
data2d
private final int data2dOrdering index for the HORIZONTALS field (S-W-N-E) -
name
-
axis
-
axisDirection
-
normal
Normalized vector that points in the direction of this Direction -
VALUES
-
BY_3D_DATA
-
BY_2D_DATA
All Facings with horizontal axis in order S-W-N-E
-
-
Constructor Details
-
Direction
private Direction(int pData3d, int pOppositeIndex, int pData2d, String pName, Direction.AxisDirection pAxisDirection, Direction.Axis pAxis, Vec3i pNormal)
-
-
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
-
orderedByNearest
Gets theDirection
values for the provided entity's looking direction. Dependent on yaw and pitch of entity looking. -
makeDirectionArray
-
rotate
-
allShuffled
-
stream
-
getRotation
public org.joml.Quaternionf getRotation() -
get3DDataValue
public int get3DDataValue() -
get2DDataValue
public int get2DDataValue() -
getAxisDirection
-
getFacingAxis
-
getOpposite
-
getClockWise
-
getCounterClockWise
-
getClockWise
-
getClockWiseX
-
getCounterClockWiseX
-
getClockWiseZ
-
getCounterClockWiseZ
-
getCounterClockWise
-
getStepX
public int getStepX() -
getStepY
public int getStepY() -
getStepZ
public int getStepZ() -
step
public org.joml.Vector3f step() -
getName
-
getAxis
-
byName
- Returns:
- the Direction specified by the given name or null if no such Direction exists
-
from3DDataValue
- Returns:
- the
Direction
corresponding to the given index (0-5). Out of bounds values are wrapped around. The order is D-U-N-S-W-E. - See Also:
-
from2DDataValue
- Returns:
- the Direction corresponding to the given horizontal index (0-3). Out of bounds values are wrapped around. The order is S-W-N-E.
- See Also:
-
fromDelta
-
fromYRot
- Returns:
- the Direction corresponding to the given angle in degrees (0-360). Out of bounds values are wrapped around. An angle of 0 is SOUTH, an angle of 90 would be WEST.
-
fromAxisAndDirection
public static Direction fromAxisAndDirection(Direction.Axis pAxis, Direction.AxisDirection pAxisDirection) -
toYRot
public float toYRot() -
getRandom
-
getNearest
-
getNearest
-
getNearest
-
toString
-
getSerializedName
- Specified by:
getSerializedName
in interfaceStringRepresentable
-
verifyVertical
-
get
-
getNormal
-
isFacingAngle
public boolean isFacingAngle(float pDegrees)
-