mirror of
https://github.com/MineLittlePony/MineLittlePony.git
synced 2024-11-22 20:47:59 +01:00
Implement piglin dancing
This commit is contained in:
parent
a856ac8fce
commit
f73f053c06
2 changed files with 33 additions and 8 deletions
|
@ -70,7 +70,7 @@ public abstract class AbstractPonyModel<T extends LivingEntity> extends ClientPo
|
||||||
|
|
||||||
super.setAngles(entity, move, swing, ticks, headYaw, headPitch);
|
super.setAngles(entity, move, swing, ticks, headYaw, headPitch);
|
||||||
|
|
||||||
updateHeadRotation(headYaw, headPitch);
|
rotateHead(headYaw, headPitch);
|
||||||
shakeBody(move, swing, getWobbleAmount(), ticks);
|
shakeBody(move, swing, getWobbleAmount(), ticks);
|
||||||
rotateLegs(move, swing, ticks, entity);
|
rotateLegs(move, swing, ticks, entity);
|
||||||
|
|
||||||
|
@ -211,7 +211,7 @@ public abstract class AbstractPonyModel<T extends LivingEntity> extends ClientPo
|
||||||
* @param x New rotation X
|
* @param x New rotation X
|
||||||
* @param y New rotation Y
|
* @param y New rotation Y
|
||||||
*/
|
*/
|
||||||
private void updateHeadRotation(float headYaw, float headPitch) {
|
private void rotateHead(float headYaw, float headPitch) {
|
||||||
headYaw = 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;
|
||||||
|
|
||||||
|
|
|
@ -49,6 +49,16 @@ public class PiglinPonyModel extends ZomponyModel<HostileEntity> {
|
||||||
public void setAngles(HostileEntity entity, float move, float swing, float ticks, float headYaw, float headPitch) {
|
public void setAngles(HostileEntity entity, float move, float swing, float ticks, float headYaw, float headPitch) {
|
||||||
super.setAngles(entity, move, swing, ticks, headYaw, headPitch);
|
super.setAngles(entity, move, swing, ticks, headYaw, headPitch);
|
||||||
|
|
||||||
|
float progress = ticks * 0.1F + move * 0.5F;
|
||||||
|
float range = 0.08F + swing * 0.4F;
|
||||||
|
rightFlap.roll = -0.5235988F - MathHelper.cos(progress * 1.2F) * range;
|
||||||
|
leftFlap.roll = 0.5235988F + MathHelper.cos(progress) * range;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void rotateLegs(float move, float swing, float ticks, HostileEntity entity) {
|
||||||
|
super.rotateLegs(move, swing, ticks, entity);
|
||||||
|
|
||||||
if (activity == PiglinActivity.ADMIRING_ITEM) {
|
if (activity == PiglinActivity.ADMIRING_ITEM) {
|
||||||
leftArm.yaw = 0.5F;
|
leftArm.yaw = 0.5F;
|
||||||
leftArm.pitch = -1.9F;
|
leftArm.pitch = -1.9F;
|
||||||
|
@ -59,15 +69,30 @@ public class PiglinPonyModel extends ZomponyModel<HostileEntity> {
|
||||||
head.yaw = 0;
|
head.yaw = 0;
|
||||||
|
|
||||||
head.roll = MathHelper.sin(ticks / 10) / 3F;
|
head.roll = MathHelper.sin(ticks / 10) / 3F;
|
||||||
|
} else if (activity == PiglinActivity.DANCING) {
|
||||||
|
|
||||||
|
float speed = ticks / 60;
|
||||||
|
|
||||||
helmet.copyPositionAndRotation(head);
|
head.pivotX = MathHelper.sin(speed * 10);
|
||||||
|
head.pivotY = MathHelper.sin(speed * 40) + 0.4F;
|
||||||
|
head.pitch += MathHelper.sin(speed * 40) / 4 + 0.4F;
|
||||||
|
|
||||||
|
float bodyBob = MathHelper.sin(speed * 40) * 0.35F;
|
||||||
|
float legBob = MathHelper.sin(speed * 40) * 0.25F;
|
||||||
|
|
||||||
|
neck.pivotY = bodyBob;
|
||||||
|
torso.pivotY = bodyBob;
|
||||||
|
upperTorso.pivotY = bodyBob;
|
||||||
|
|
||||||
|
leftLeg.pitch += legBob;
|
||||||
|
rightLeg.pitch -= legBob;
|
||||||
|
|
||||||
|
leftArm.roll -= legBob/4;
|
||||||
|
rightArm.roll += legBob/4;
|
||||||
|
|
||||||
|
rightArm.pitch += legBob - 0.4F;
|
||||||
|
leftArm.pitch -= legBob + 0.4F;
|
||||||
}
|
}
|
||||||
|
|
||||||
float progress = ticks * 0.1F + move * 0.5F;
|
|
||||||
float range = 0.08F + swing * 0.4F;
|
|
||||||
rightFlap.roll = -0.5235988F - MathHelper.cos(progress * 1.2F) * range;
|
|
||||||
leftFlap.roll = 0.5235988F + MathHelper.cos(progress) * range;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in a new issue