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 Enum
Enum.EnumDesc<E>Nested classes/interfaces inherited from interface StringRepresentable
StringRepresentable.EnumCodec<E>, StringRepresentable.StringRepresentableCodec<S> -
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 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> private static final ImmutableList<Direction.Axis> private static final ImmutableList<Direction.Axis> Fields inherited from interface 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 ImmutableList<Direction.Axis> axisStepOrder(Vec3 movement) static @Nullable Directionstatic Directionfrom2DDataValue(int data) static Directionfrom3DDataValue(int data) static DirectionfromAxisAndDirection(Direction.Axis axis, Direction.AxisDirection direction) static DirectionfromYRot(double yRot) static Directionget(Direction.AxisDirection axisDirection, Direction.Axis axis) intintstatic DirectiongetApproximateNearest(double dx, double dy, double dz) static DirectiongetApproximateNearest(float dx, float dy, float dz) static DirectiongetAxis()getClockWise(Direction.Axis axis) private Directionprivate Directionprivate Directionprivate Directionstatic DirectiongetFacingAxis(Entity entity, Direction.Axis axis) getName()static @Nullable DirectiongetNearest(int x, int y, int z, @Nullable Direction orElse) static @Nullable DirectiongetNearest(Vec3i vec, @Nullable Direction orElse) static DirectiongetRandom(RandomSource random) intgetStepX()intgetStepY()intgetStepZ()static floatbooleanisFacingAngle(float yAngle) private static Direction[]makeDirectionArray(Direction axis1, Direction axis2, Direction axis3) static Direction[]orderedByNearest(Entity entity) Gets theDirectionvalues for the provided entity's looking direction.static Directionstep()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>
-
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. -
YXZ_AXIS_ORDER
-
YZX_AXIS_ORDER
-
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
-
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
-
makeDirectionArray
-
rotate
-
allShuffled
-
stream
-
getYRot
-
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
-
getName
-
getAxis
-
byName
-
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 direction) -
toYRot
public float toYRot() -
getRandom
-
getApproximateNearest
-
getApproximateNearest
-
getApproximateNearest
-
getNearest
-
getNearest
-
toString
-
getSerializedName
- Specified by:
getSerializedNamein interfaceStringRepresentable
-
verifyVertical
-
get
-
axisStepOrder
-
getUnitVec3i
-
getUnitVec3
-
getUnitVec3f
-
isFacingAngle
public boolean isFacingAngle(float yAngle)
-