Fixed encorrect head rotation when swimming/crawling

This commit is contained in:
Sollace 2019-08-11 13:55:39 +02:00
parent aff5920b0e
commit 0a32b1af06

View file

@ -208,14 +208,22 @@ public abstract class AbstractPonyModel<T extends LivingEntity> extends ClientPo
* @param y New rotation Y
*/
private void updateHeadRotation(float headYaw, float headPitch) {
head.yaw = attributes.isSleeping ? (Math.abs(attributes.interpolatorId.getMostSignificantBits()) % 2.8F) - 1.9F : headYaw / 57.29578F;
headYaw = attributes.isSleeping ? (Math.abs(attributes.interpolatorId.getMostSignificantBits()) % 2.8F) - 1.9F : headYaw / 57.29578F;
headPitch = attributes.isSleeping ? 0.1f : headPitch / 57.29578F;
if (attributes.isSwimming && attributes.motionPitch != 0) {
headPitch -= 0.9F;
}
head.yaw = 0;
head.roll = 0;
if (attributes.isSwimmingRotated) {
head.roll = -headYaw;
} else {
head.yaw = headYaw;
}
float pitch = (float)Math.toRadians(attributes.motionPitch);
head.pitch = MathHelper.clamp(headPitch, -1.25f - pitch, 0.5f - pitch);