Enum Class Direction

java.lang.Object
java.lang.Enum<Direction>
net.minecraft.core.Direction
All Implemented Interfaces:
Serializable, Comparable<Direction>, Constable, StringRepresentable

public enum Direction extends Enum<Direction> implements StringRepresentable
  • Enum Constant Details

  • Field Details

    • CODEC

      public static final StringRepresentable.EnumCodec<Direction> CODEC
    • VERTICAL_CODEC

      public static final com.mojang.serialization.Codec<Direction> VERTICAL_CODEC
    • BY_ID

      public static final IntFunction<Direction> BY_ID
    • STREAM_CODEC

      public static final StreamCodec<io.netty.buffer.ByteBuf,Direction> STREAM_CODEC
    • data3d

      private final int data3d
      Ordering index for D-U-N-S-W-E
    • oppositeIndex

      private final int oppositeIndex
      Index of the opposite Direction in the VALUES array
    • data2d

      private final int data2d
      Ordering index for the HORIZONTALS field (S-W-N-E)
    • name

      private final String name
    • axis

      private final Direction.Axis axis
    • axisDirection

      private final Direction.AxisDirection axisDirection
    • normal

      private final Vec3i normal
      Normalized vector that points in the direction of this Direction
    • VALUES

      private static final Direction[] VALUES
    • BY_3D_DATA

      private static final Direction[] BY_3D_DATA
    • BY_2D_DATA

      private static final Direction[] BY_2D_DATA
      All Facings with horizontal axis in order S-W-N-E
  • Constructor Details

  • Method Details

    • values

      public static Direction[] 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

      public static Direction valueOf(String name)
      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 name
      NullPointerException - if the argument is null
    • orderedByNearest

      public static Direction[] orderedByNearest(Entity pEntity)
      Gets the Direction values for the provided entity's looking direction. Dependent on yaw and pitch of entity looking.
    • makeDirectionArray

      private static Direction[] makeDirectionArray(Direction pFirst, Direction pSecond, Direction pThird)
    • rotate

      public static Direction rotate(org.joml.Matrix4f p_254393_, Direction p_254252_)
    • allShuffled

      public static Collection<Direction> allShuffled(RandomSource pRandom)
    • stream

      public static Stream<Direction> stream()
    • getRotation

      public org.joml.Quaternionf getRotation()
    • get3DDataValue

      public int get3DDataValue()
    • get2DDataValue

      public int get2DDataValue()
    • getAxisDirection

      public Direction.AxisDirection getAxisDirection()
    • getFacingAxis

      public static Direction getFacingAxis(Entity pEntity, Direction.Axis pAxis)
    • getOpposite

      public Direction getOpposite()
    • getClockWise

      public Direction getClockWise(Direction.Axis pAxis)
    • getCounterClockWise

      public Direction getCounterClockWise(Direction.Axis pAxis)
    • getClockWise

      public Direction getClockWise()
    • getClockWiseX

      private Direction getClockWiseX()
    • getCounterClockWiseX

      private Direction getCounterClockWiseX()
    • getClockWiseZ

      private Direction getClockWiseZ()
    • getCounterClockWiseZ

      private Direction getCounterClockWiseZ()
    • getCounterClockWise

      public Direction getCounterClockWise()
    • getStepX

      public int getStepX()
    • getStepY

      public int getStepY()
    • getStepZ

      public int getStepZ()
    • step

      public org.joml.Vector3f step()
    • getName

      public String getName()
    • getAxis

      public Direction.Axis getAxis()
    • byName

      @Nullable public static Direction byName(@Nullable String pName)
      Returns:
      the Direction specified by the given name or null if no such Direction exists
    • from3DDataValue

      public static Direction from3DDataValue(int pIndex)
      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

      public static Direction from2DDataValue(int pHorizontalIndex)
      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

      @Nullable public static Direction fromDelta(int pX, int pY, int pZ)
    • fromYRot

      public static Direction fromYRot(double pAngle)
      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

      public static Direction getRandom(RandomSource pRandom)
    • getNearest

      public static Direction getNearest(double pX, double pY, double pZ)
    • getNearest

      public static Direction getNearest(float pX, float pY, float pZ)
    • getNearest

      public static Direction getNearest(Vec3 pOis)
    • toString

      public String toString()
      Overrides:
      toString in class Enum<Direction>
    • getSerializedName

      public String getSerializedName()
      Specified by:
      getSerializedName in interface StringRepresentable
    • verifyVertical

      private static com.mojang.serialization.DataResult<Direction> verifyVertical(Direction p_194529_)
    • get

      public static Direction get(Direction.AxisDirection pAxisDirection, Direction.Axis pAxis)
    • getNormal

      public Vec3i getNormal()
    • isFacingAngle

      public boolean isFacingAngle(float pDegrees)