Contents
Class YawRotation
java.lang.Object
com.hypixel.hytale.builtin.triggervolumes.YawRotation
Helpers for applying a prefab paste or world-gen yaw to trigger volume data. The paste yaw
follows the entity transform convention: a yaw of
theta moves world offsets exactly
like Vector3d.rotateY(double) and composes with block rotations as
Rotation.ofDegrees(toDegrees(theta)).-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final doubleYaws below this magnitude (radians) are treated as no rotation. -
Method Summary
Modifier and TypeMethodDescriptionstatic floataddDegrees(float degrees, float yawRadians) Adds the yaw to a facing in degrees, normalized to [0, 360).static intquarterTurns(float yawRadians) Number of exact quarter turns in the yaw (0..3), or -1 when the yaw is not a multiple of 90 degrees.static RotationComposes quarter turns onto a block rotation.static voidrotate(org.joml.Vector3d vector, float yawRadians) Rotates the vector's XZ components around the origin by the yaw.static voidrotateBlockOffset(org.joml.Vector3d offset, float yawRadians, org.joml.Vector3d volumeOrigin) Rotates a block-targeting offset (relative tovolumeOrigin) about that origin, using the target cell's CENTER as the pivot point rather than the offset vector's corner.
-
Field Details
-
EPSILON
public static final double EPSILONYaws below this magnitude (radians) are treated as no rotation.- See Also:
-
-
Method Details
-
rotate
public static void rotate(@Nonnull org.joml.Vector3d vector, float yawRadians) Rotates the vector's XZ components around the origin by the yaw. Quarter-turn yaws use exact component swaps so block-aligned coordinates stay exact instead of picking upcos(pi/2)floating-point dust that would changefloor()results. -
rotateBlockOffset
public static void rotateBlockOffset(@Nonnull org.joml.Vector3d offset, float yawRadians, @Nonnull org.joml.Vector3d volumeOrigin) Rotates a block-targeting offset (relative tovolumeOrigin) about that origin, using the target cell's CENTER as the pivot point rather than the offset vector's corner. This matches how real blocks rotate on the grid, so an even-sized volume (origin on a cell boundary) rotates its placements the same as an odd-sized one (origin on a cell center); it reduces to a plain offset rotation for odd volumes. Only the X and Z components change; Y is left untouched.The resolved block stays
floor(volumeOrigin + offset), so callers rotate here and then resolve normally. The offset gains fractional X/Z (the cell-center remainder), which is expected. -
quarterTurns
public static int quarterTurns(float yawRadians) Number of exact quarter turns in the yaw (0..3), or -1 when the yaw is not a multiple of 90 degrees. Fields limited to 90-degree steps (block rotations) only compose at exact quarter turns and stay unchanged for arbitrary yaws. -
rotate
-
addDegrees
public static float addDegrees(float degrees, float yawRadians) Adds the yaw to a facing in degrees, normalized to [0, 360).
-