Package net.minecraft.core
Enum Class Direction
- All Implemented Interfaces:
Serializable,Comparable<Direction>,Constable,StringRepresentable
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumstatic enumstatic enumNested 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.Axisprivate final Direction.AxisDirectionprivate 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 intOrdering index for the HORIZONTALS field (S-W-N-E)private final intOrdering index for D-U-N-S-W-Estatic final com.mojang.serialization.Codec<Direction> Deprecated.static final com.mojang.serialization.Codec<Direction> Deprecated.private final Stringprivate final Vec3iNormalized vector that points in the direction of this Directionprivate final Vec3private final org.joml.Vector3fcprivate final intIndex 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
ConstructorsModifierConstructorDescriptionprivateDirection(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 Directionstatic Directionfrom2DDataValue(int p_122408_) static Directionfrom3DDataValue(int p_122377_) static DirectionfromAxisAndDirection(Direction.Axis pAxis, Direction.AxisDirection pAxisDirection) static DirectionfromYRot(double pAngle) static Directionget(Direction.AxisDirection pAxisDirection, Direction.Axis pAxis) intintstatic DirectiongetApproximateNearest(double pX, double pY, double pZ) static DirectiongetApproximateNearest(float pX, float pY, float pZ) static DirectiongetApproximateNearest(Vec3 pVector) getAxis()getClockWise(Direction.Axis pAxis) private Directionprivate Directionprivate Directionprivate Directionstatic DirectiongetFacingAxis(Entity pEntity, Direction.Axis pAxis) getName()static DirectiongetNearest(int pX, int pY, int pZ, Direction pDefaultValue) static DirectiongetNearest(Vec3i pVector, Direction pDefaultValue) static DirectiongetRandom(RandomSource pRandom) org.joml.QuaternionfintgetStepX()intgetStepY()intgetStepZ()org.joml.Vector3fcstatic floatbooleanisFacingAngle(float pDegrees) private static Direction[]makeDirectionArray(Direction pFirst, Direction pSecond, Direction pThird) static Direction[]orderedByNearest(Entity pEntity) Gets theDirectionvalues for the provided entity's looking direction.static Directionorg.joml.Vector3fstep()stream()toString()floattoYRot()static DirectionReturns 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
-
LEGACY_ID_CODEC
Deprecated. -
LEGACY_ID_CODEC_2D
Deprecated. -
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 -
normalVec3
-
normalVec3f
private final org.joml.Vector3fc normalVec3f -
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 theDirectionvalues for the provided entity's looking direction. Dependent on yaw and pitch of entity looking. -
makeDirectionArray
-
rotate
-
allShuffled
-
stream
-
getYRot
-
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
Directioncorresponding 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:
-
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
-
getApproximateNearest
-
getApproximateNearest
-
getApproximateNearest
-
getNearest
-
getNearest
-
toString
-
getSerializedName
- Specified by:
getSerializedNamein interfaceStringRepresentable
-
verifyVertical
-
get
-
getUnitVec3i
-
getUnitVec3
-
getUnitVec3f
public org.joml.Vector3fc getUnitVec3f() -
isFacingAngle
public boolean isFacingAngle(float pDegrees)
-