mirror of
https://github.com/MineLittlePony/MineLittlePony.git
synced 2025-02-13 16:24:23 +01:00
Fixed head positioning on swimming ponies
This commit is contained in:
parent
c09d9d3a1e
commit
f1d1a2857d
2 changed files with 17 additions and 5 deletions
|
@ -82,8 +82,13 @@ public abstract class AbstractPonyModel<T extends LivingEntity> extends ClientPo
|
||||||
rightLeg.rotationPointY = FRONT_LEG_RP_Y_NOTSNEAK;
|
rightLeg.rotationPointY = FRONT_LEG_RP_Y_NOTSNEAK;
|
||||||
leftLeg.rotationPointY = FRONT_LEG_RP_Y_NOTSNEAK;
|
leftLeg.rotationPointY = FRONT_LEG_RP_Y_NOTSNEAK;
|
||||||
animateBreathing(ticks);
|
animateBreathing(ticks);
|
||||||
|
|
||||||
|
if (attributes.isSwimming) {
|
||||||
|
head.setRotationPoint(0, -2, -2);
|
||||||
|
} else {
|
||||||
head.setRotationPoint(0, 0, 0);
|
head.setRotationPoint(0, 0, 0);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (attributes.isSleeping) {
|
if (attributes.isSleeping) {
|
||||||
ponySleep();
|
ponySleep();
|
||||||
|
@ -204,14 +209,14 @@ public abstract class AbstractPonyModel<T extends LivingEntity> extends ClientPo
|
||||||
head.yaw = attributes.isSleeping ? (Math.abs(attributes.interpolatorId.getMostSignificantBits()) % 2.8F) - 1.9F : headYaw / 57.29578F;
|
head.yaw = 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;
|
||||||
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) {
|
if (attributes.isSwimming) {
|
||||||
headPitch += 0.9F;
|
headPitch -= 0.9F;
|
||||||
}
|
}
|
||||||
|
|
||||||
head.pitch = headPitch;
|
float pitch = (float)Math.toRadians(attributes.motionPitch);
|
||||||
|
|
||||||
|
head.pitch = MathHelper.clamp(headPitch, -1.25f - pitch, 0.5f - pitch);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -25,6 +25,7 @@ public enum PonyTransformation {
|
||||||
break;
|
break;
|
||||||
case HEAD:
|
case HEAD:
|
||||||
if (model.getAttributes().isCrouching) translate(0, 0.1F, 0);
|
if (model.getAttributes().isCrouching) translate(0, 0.1F, 0);
|
||||||
|
if (model.getAttributes().isSwimming) translate(0, 0.07F, 0.15F);
|
||||||
break;
|
break;
|
||||||
case BACK:
|
case BACK:
|
||||||
translateVec(riderOffset);
|
translateVec(riderOffset);
|
||||||
|
@ -44,11 +45,13 @@ public enum PonyTransformation {
|
||||||
case NECK:
|
case NECK:
|
||||||
translate(0, -0.15F, -0.07F);
|
translate(0, -0.15F, -0.07F);
|
||||||
if (model.getAttributes().isCrouching) translate(-0.03F, 0.16F, 0.07F);
|
if (model.getAttributes().isCrouching) translate(-0.03F, 0.16F, 0.07F);
|
||||||
|
if (model.getAttributes().isSwimming) translate(0, 0.5F, 0.25F);
|
||||||
break;
|
break;
|
||||||
case HEAD:
|
case HEAD:
|
||||||
translate(0, -0.17F, -0.04F);
|
translate(0, -0.17F, -0.04F);
|
||||||
if (model.getAttributes().isSleeping) translate(0, 0, -0.1F);
|
if (model.getAttributes().isSleeping) translate(0, 0, -0.1F);
|
||||||
if (model.getAttributes().isCrouching) translate(0, 0.15F, 0);
|
if (model.getAttributes().isCrouching) translate(0, 0.15F, 0);
|
||||||
|
if (model.getAttributes().isSwimming) translate(0, 0.25F, 0.25F);
|
||||||
break;
|
break;
|
||||||
case BODY:
|
case BODY:
|
||||||
translate(0, -0.2F, -0.04F);
|
translate(0, -0.2F, -0.04F);
|
||||||
|
@ -78,11 +81,13 @@ public enum PonyTransformation {
|
||||||
case NECK:
|
case NECK:
|
||||||
translate(0, -0.15F, -0.07F);
|
translate(0, -0.15F, -0.07F);
|
||||||
if (model.getAttributes().isCrouching) translate(-0.03F, 0.16F, 0.07F);
|
if (model.getAttributes().isCrouching) translate(-0.03F, 0.16F, 0.07F);
|
||||||
|
if (model.getAttributes().isSwimming) translate(0, 0.5F, 0.25F);
|
||||||
break;
|
break;
|
||||||
case HEAD:
|
case HEAD:
|
||||||
translate(0, -0.17F, -0.04F);
|
translate(0, -0.17F, -0.04F);
|
||||||
if (model.getAttributes().isSleeping) translate(0, 0, -0.1F);
|
if (model.getAttributes().isSleeping) translate(0, 0, -0.1F);
|
||||||
if (model.getAttributes().isCrouching) translate(0, 0.15F, 0);
|
if (model.getAttributes().isCrouching) translate(0, 0.15F, 0);
|
||||||
|
if (model.getAttributes().isSwimming) translate(0, 0.15F, 0.25F);
|
||||||
break;
|
break;
|
||||||
case BODY:
|
case BODY:
|
||||||
translate(0, -0.2F, -0.04F);
|
translate(0, -0.2F, -0.04F);
|
||||||
|
@ -146,6 +151,7 @@ public enum PonyTransformation {
|
||||||
case HEAD:
|
case HEAD:
|
||||||
translate(0.01F, -0.15F, 0);
|
translate(0.01F, -0.15F, 0);
|
||||||
if (model.getAttributes().isCrouching) translate(0, 0.04F, 0);
|
if (model.getAttributes().isCrouching) translate(0, 0.04F, 0);
|
||||||
|
if (model.getAttributes().isSwimming) translate(0, 0.17F, 0.25F);
|
||||||
break;
|
break;
|
||||||
case BODY:
|
case BODY:
|
||||||
case TAIL:
|
case TAIL:
|
||||||
|
@ -179,6 +185,7 @@ public enum PonyTransformation {
|
||||||
case HEAD:
|
case HEAD:
|
||||||
translate(0, -0.15F, 0.01F);
|
translate(0, -0.15F, 0.01F);
|
||||||
if (model.getAttributes().isCrouching) translate(0, 0.04F, 0);
|
if (model.getAttributes().isCrouching) translate(0, 0.04F, 0);
|
||||||
|
if (model.getAttributes().isSwimming) translate(0, 0.2F, 0.25F);
|
||||||
scale(1.15F, 1.15F, 1.15F);
|
scale(1.15F, 1.15F, 1.15F);
|
||||||
break;
|
break;
|
||||||
case BODY:
|
case BODY:
|
||||||
|
|
Loading…
Reference in a new issue