Record Class Rotation

java.lang.Object
java.lang.Record
dev.latvian.mods.klib.math.Rotation

public record Rotation(float yaw, float pitch, float roll, Rotation.Type type) extends Record
  • Field Details

    • CODEC

      public static final com.mojang.serialization.Codec<Rotation> CODEC
    • CODEC_WITH_ROLL

      public static final com.mojang.serialization.Codec<Rotation> CODEC_WITH_ROLL
    • STREAM_CODEC

      public static final net.minecraft.network.codec.StreamCodec<io.netty.buffer.ByteBuf, Rotation> STREAM_CODEC
    • STREAM_CODEC_WITH_ROLL

      public static final net.minecraft.network.codec.StreamCodec<io.netty.buffer.ByteBuf, Rotation> STREAM_CODEC_WITH_ROLL
    • DATA_TYPE

      public static final DataType<Rotation> DATA_TYPE
    • DATA_TYPE_WITH_ROLL

      public static final DataType<Rotation> DATA_TYPE_WITH_ROLL
    • NONE

      public static final Rotation NONE
  • Constructor Details

    • Rotation

      public Rotation(float yaw, float pitch, float roll, Rotation.Type type)
      Creates an instance of a Rotation record class.
      Parameters:
      yaw - the value for the yaw record component
      pitch - the value for the pitch record component
      roll - the value for the roll record component
      type - the value for the type record component
  • Method Details

    • deg

      public static Rotation deg(float yaw, float pitch, float roll)
    • deg

      public static Rotation deg(float yaw, float pitch)
    • deg

      public static Rotation deg(float yaw)
    • deg

      public static Rotation deg(net.minecraft.world.phys.Vec2 rotation)
    • rad

      public static Rotation rad(float yaw, float pitch, float roll)
    • rad

      public static Rotation rad(float yaw, float pitch)
    • rad

      public static Rotation rad(float yaw)
    • of

      public static Rotation of(@Nullable @Nullable net.minecraft.world.entity.Entity entity, float delta)
    • compute

      public static Rotation compute(net.minecraft.world.phys.Vec3 source, net.minecraft.world.phys.Vec3 target, float roll)
    • compute

      public static Rotation compute(net.minecraft.world.phys.Vec3 source, net.minecraft.world.phys.Vec3 target)
    • yawDeg

      public float yawDeg()
    • pitchDeg

      public float pitchDeg()
    • rollDeg

      public float rollDeg()
    • yawRad

      public float yawRad()
    • pitchRad

      public float pitchRad()
    • rollRad

      public float rollRad()
    • toDeg

      public Rotation toDeg()
    • toRad

      public Rotation toRad()
    • lerp

      public Rotation lerp(float delta, Rotation to)
    • lookVec3

      public net.minecraft.world.phys.Vec3 lookVec3(double dist)
    • lookVec3f

      public Vec3f lookVec3f(float dist)
    • toString

      public String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • isNone

      public boolean isNone()
    • isYawOnly

      public boolean isYawOnly()
    • rotateYXZ

      public org.joml.Matrix4f rotateYXZ(org.joml.Matrix4f mat)
    • rotateYXZ

      public org.joml.Matrix3f rotateYXZ(org.joml.Matrix3f mat)
    • rotateZXY

      public org.joml.Matrix4f rotateZXY(org.joml.Matrix4f mat)
    • rotateZXY

      public org.joml.Matrix3f rotateZXY(org.joml.Matrix3f mat)
    • isSimilar

      public boolean isSimilar(Rotation other)
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with the compare method from their corresponding wrapper classes.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • yaw

      public float yaw()
      Returns the value of the yaw record component.
      Returns:
      the value of the yaw record component
    • pitch

      public float pitch()
      Returns the value of the pitch record component.
      Returns:
      the value of the pitch record component
    • roll

      public float roll()
      Returns the value of the roll record component.
      Returns:
      the value of the roll record component
    • type

      public Rotation.Type type()
      Returns the value of the type record component.
      Returns:
      the value of the type record component