Fixed head position and animation whilst swimming/crawling

This commit is contained in:
Sollace 2019-06-26 15:44:15 +02:00
parent b290d4c7e7
commit 833f11b4e9
2 changed files with 10 additions and 4 deletions

View file

@ -207,6 +207,10 @@ public abstract class AbstractPonyModel<T extends LivingEntity> extends ClientPo
headPitch = Math.min(headPitch, (float) (0.5f - Math.toRadians(attributes.motionPitch)));
headPitch = Math.max(headPitch, (float) (-1.25f - Math.toRadians(attributes.motionPitch)));
if (attributes.isSwimming) {
headPitch += 0.9F;
}
head.pitch = headPitch;
}
@ -258,10 +262,12 @@ public abstract class AbstractPonyModel<T extends LivingEntity> extends ClientPo
*/
protected void rotateLegsSwimming(float move, float swing, float ticks, T entity) {
float legLeft = (ROTATE_90 + MathHelper.sin((move / 3) + 2 * PI/3) / 2) * (float)attributes.motionLerp;
float lerp = entity.isSwimming() ? (float)attributes.motionLerp : 1;
float left = (ROTATE_90 + MathHelper.sin((move / 3) + 2 * PI) / 2) * (float)attributes.motionLerp;
float right = (ROTATE_90 + MathHelper.sin(move / 3) / 2) * (float)attributes.motionLerp;
float legLeft = (ROTATE_90 + MathHelper.sin((move / 3) + 2 * PI/3) / 2) * lerp;
float left = (ROTATE_90 + MathHelper.sin((move / 3) + 2 * PI) / 2) * lerp;
float right = (ROTATE_90 + MathHelper.sin(move / 3) / 2) * lerp;
leftArm.pitch = -left;
leftArm.yaw = -left/2;

View file

@ -152,7 +152,7 @@ public class Pony implements IPony {
@Override
public boolean isSwimming(LivingEntity entity) {
return entity.isSwimming();
return entity.isSwimming() || entity.isInSwimmingPose();
}
@Override