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 data3d, int oppositeIndex, int data2d, String name, Direction.AxisDirection axisDirection, Direction.Axis axis, Vec3i normal) -
Method Summary
Modifier and TypeMethodDescriptionstatic Collection<Direction> allShuffled(RandomSource random) static Directionstatic Directionfrom2DDataValue(int horizontalIndex) static Directionfrom3DDataValue(int index) static DirectionfromAxisAndDirection(Direction.Axis axis, Direction.AxisDirection axisDirection) static DirectionfromYRot(double angle) static Directionget(Direction.AxisDirection axisDirection, Direction.Axis axis) intintstatic DirectiongetApproximateNearest(double x, double y, double z) static DirectiongetApproximateNearest(float x, float y, float z) static DirectiongetApproximateNearest(Vec3 vector) getAxis()getClockWise(Direction.Axis axis) private Directionprivate Directionprivate Directionprivate Directionstatic DirectiongetFacingAxis(Entity entity, Direction.Axis axis) getName()static DirectiongetNearest(int x, int y, int z, Direction defaultValue) static DirectiongetNearest(Vec3i vector, Direction defaultValue) static DirectiongetRandom(RandomSource random) org.joml.QuaternionfintgetStepX()intgetStepY()intgetStepZ()org.joml.Vector3fcstatic floatbooleanisFacingAngle(float degrees) private static Direction[]makeDirectionArray(Direction first, Direction second, Direction third) static Direction[]orderedByNearest(Entity entity) 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 direction)
-
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 data3d, int oppositeIndex, int data2d, String name, Direction.AxisDirection axisDirection, Direction.Axis axis, Vec3i normal)
-
-
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 axis, Direction.AxisDirection axisDirection) -
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 degrees)
-