mirror of
https://github.com/MineLittlePony/MineLittlePony.git
synced 2025-02-16 17:44:23 +01:00
Fixed encorrect head rotation when swimming/crawling
This commit is contained in:
parent
aff5920b0e
commit
0a32b1af06
1 changed files with 10 additions and 2 deletions
|
@ -208,14 +208,22 @@ public abstract class AbstractPonyModel<T extends LivingEntity> extends ClientPo
|
||||||
* @param y New rotation Y
|
* @param y New rotation Y
|
||||||
*/
|
*/
|
||||||
private void updateHeadRotation(float headYaw, float headPitch) {
|
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;
|
headPitch = attributes.isSleeping ? 0.1f : headPitch / 57.29578F;
|
||||||
|
|
||||||
if (attributes.isSwimming && attributes.motionPitch != 0) {
|
if (attributes.isSwimming && attributes.motionPitch != 0) {
|
||||||
headPitch -= 0.9F;
|
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);
|
float pitch = (float)Math.toRadians(attributes.motionPitch);
|
||||||
|
|
||||||
head.pitch = MathHelper.clamp(headPitch, -1.25f - pitch, 0.5f - pitch);
|
head.pitch = MathHelper.clamp(headPitch, -1.25f - pitch, 0.5f - pitch);
|
||||||
|
|
Loading…
Reference in a new issue