Fixed swinging animation not playing for horny ponies

This commit is contained in:
Sollace 2018-06-02 20:05:22 +02:00
parent 12600fff3d
commit 7f6a01cf9d
3 changed files with 20 additions and 16 deletions

View file

@ -101,12 +101,7 @@ public abstract class AbstractPonyModel extends ModelPlayer implements IModel {
updateHeadRotation(headRotateAngleX, headRotateAngleY);
float bodySwingRotation = 0;
if (swingProgress > -9990.0F && !metadata.hasMagic()) {
bodySwingRotation = MathHelper.sin(MathHelper.sqrt(swingProgress) * PI * 2) * 0.2F;
}
rotateLook(move, swing, bodySwingRotation, ticks);
rotateLook(move, swing, getWobbleAmount(), ticks);
setLegs(move, swing, ticks, entity);
if (!rainboom) {
@ -151,6 +146,13 @@ public abstract class AbstractPonyModel extends ModelPlayer implements IModel {
snout.setGender(metadata.getGender());
}
protected float getWobbleAmount() {
if (swingProgress <= -9990.0F) {
return 0;
}
return MathHelper.sin(MathHelper.sqrt(swingProgress) * PI * 2) * 0.2F;
}
protected void adjustBodyRiding() {
adjustBodyComponents(BODY_ROTATE_ANGLE_X_RIDING, BODY_RP_Y_RIDING, BODY_RP_Z_RIDING);
adjustNeck(BODY_ROTATE_ANGLE_X_NOTSNEAK, BODY_RP_Y_NOTSNEAK, BODY_RP_Z_NOTSNEAK);

View file

@ -38,6 +38,13 @@ public class ModelUnicorn extends ModelEarthPony implements IModelUnicorn {
unicornArmLeft.rotateAngleY = 0;
}
protected float getWobbleAmount() {
if (isCasting()) {
return 0;
}
return super.getWobbleAmount();
}
@Override
protected void adjustLegs(float move, float swing, float ticks) {
super.adjustLegs(move, swing, ticks);

View file

@ -3,7 +3,6 @@ package com.minelittlepony.model.ponies;
import net.minecraft.entity.Entity;
import net.minecraft.entity.monster.EntityZombieVillager;
import net.minecraft.entity.passive.EntityVillager;
import net.minecraft.util.math.MathHelper;
import static com.minelittlepony.model.PonyModelConstants.*;
import com.minelittlepony.model.player.ModelAlicorn;
@ -18,16 +17,12 @@ public class ModelVillagerPony extends ModelAlicorn {
}
@Override
public void setRotationAngles(float move, float swing, float ticks, float headYaw, float headPitch, float scale, Entity entity) {
super.setRotationAngles(move, swing, ticks, headYaw, headPitch, scale, entity);
protected void rotateLook(float move, float swing, float bodySwing, float ticks) {
super.rotateLook(move, swing, bodySwing, ticks);
float angleY = 0;
if (swingProgress > -9990.0F && !canCast()) {
angleY = MathHelper.sin(MathHelper.sqrt(swingProgress) * PI * 2) * 0.04F;
}
bag.rotateAngleY = angleY;
apron.rotateAngleY = angleY;
trinket.rotateAngleY = angleY;
bag.rotateAngleY = bodySwing;
apron.rotateAngleY = bodySwing;
trinket.rotateAngleY = bodySwing;
}
@Override