Package kr.toxicity.model.api.tracker
Record Class ModelRotation
java.lang.Object
java.lang.Record
kr.toxicity.model.api.tracker.ModelRotation
- Record Components:
x- the pitch (x-rotation) in degreesy- the yaw (y-rotation) in degrees
Represents the rotation of a model in degrees.
This record stores pitch (x) and yaw (y) values and provides utility methods for conversion.
- Since:
- 1.15.2
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final ModelRotationA rotation of (0, 0).static final ModelRotationAn invalid rotation value used for initialization or error states. -
Constructor Summary
ConstructorsConstructorDescriptionModelRotation(float x, float y) Creates an instance of aModelRotationrecord class. -
Method Summary
Modifier and TypeMethodDescriptionbooleanIndicates whether some other object is "equal to" this one.inthashCode()Returns a hash code value for this object.bytepackedX()Returns the pitch packed as a byte (Minecraft protocol format).bytepackedY()Returns the yaw packed as a byte (Minecraft protocol format).@NotNull ModelRotationpitch()Returns a new rotation with only the pitch component.floatradianX()Returns the pitch in radians.floatradianY()Returns the yaw in radians.final StringtoString()Returns a string representation of this record class.floatx()Returns the value of thexrecord component.floaty()Returns the value of theyrecord component.@NotNull ModelRotationyaw()Returns a new rotation with only the yaw component.
-
Field Details
-
EMPTY
A rotation of (0, 0).- Since:
- 1.15.2
-
INVALID
An invalid rotation value used for initialization or error states.- Since:
- 1.15.2
-
-
Constructor Details
-
Method Details
-
equals
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. All components in this record class are compared with '=='. -
hashCode
public int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
pitch
Returns a new rotation with only the pitch component.- Returns:
- the pitch-only rotation
- Since:
- 1.15.2
-
yaw
Returns a new rotation with only the yaw component.- Returns:
- the yaw-only rotation
- Since:
- 1.15.2
-
radianX
public float radianX()Returns the pitch in radians.- Returns:
- the pitch in radians
- Since:
- 1.15.2
-
radianY
public float radianY()Returns the yaw in radians.- Returns:
- the yaw in radians
- Since:
- 1.15.2
-
packedX
public byte packedX()Returns the pitch packed as a byte (Minecraft protocol format).- Returns:
- the packed pitch
- Since:
- 1.15.2
-
packedY
public byte packedY()Returns the yaw packed as a byte (Minecraft protocol format).- Returns:
- the packed yaw
- Since:
- 1.15.2
-
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. -
x
public float x()Returns the value of thexrecord component.- Returns:
- the value of the
xrecord component
-
y
public float y()Returns the value of theyrecord component.- Returns:
- the value of the
yrecord component
-