Overview
TheModelRotation class represents the rotation of a model in degrees, storing pitch (x) and yaw (y) values. It provides utility methods for conversion between degrees, radians, and Minecraft’s packed byte format.
Class Definition
x- The pitch (x-rotation) in degreesy- The yaw (y-rotation) in degrees
Constants
EMPTY
INVALID
Methods
pitch()
Returns a new rotation with only the pitch component.yaw()
Returns a new rotation with only the yaw component.radianX()
Returns the pitch in radians.radianY()
Returns the yaw in radians.packedX()
Returns the pitch packed as a byte in Minecraft protocol format.packedY()
Returns the yaw packed as a byte in Minecraft protocol format.Usage Example
Equality and Hashing
TheModelRotation record uses packed values for equality checks and hash code calculation, ensuring that rotations are compared based on their Minecraft protocol representation rather than raw float values.
See Also
- ModelScaler - For scaling models
- Tracker - For tracking model state
