From 7f6a01cf9d1dd7a7b6ffba990f157b7673804161 Mon Sep 17 00:00:00 2001 From: Sollace Date: Sat, 2 Jun 2018 20:05:22 +0200 Subject: [PATCH] Fixed swinging animation not playing for horny ponies --- .../minelittlepony/model/AbstractPonyModel.java | 14 ++++++++------ .../minelittlepony/model/player/ModelUnicorn.java | 7 +++++++ .../model/ponies/ModelVillagerPony.java | 15 +++++---------- 3 files changed, 20 insertions(+), 16 deletions(-) diff --git a/src/main/java/com/minelittlepony/model/AbstractPonyModel.java b/src/main/java/com/minelittlepony/model/AbstractPonyModel.java index a655f1d0..219e1bf5 100644 --- a/src/main/java/com/minelittlepony/model/AbstractPonyModel.java +++ b/src/main/java/com/minelittlepony/model/AbstractPonyModel.java @@ -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); diff --git a/src/main/java/com/minelittlepony/model/player/ModelUnicorn.java b/src/main/java/com/minelittlepony/model/player/ModelUnicorn.java index d758a9c1..1751c45d 100644 --- a/src/main/java/com/minelittlepony/model/player/ModelUnicorn.java +++ b/src/main/java/com/minelittlepony/model/player/ModelUnicorn.java @@ -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); diff --git a/src/main/java/com/minelittlepony/model/ponies/ModelVillagerPony.java b/src/main/java/com/minelittlepony/model/ponies/ModelVillagerPony.java index 439be4ef..bd168f31 100644 --- a/src/main/java/com/minelittlepony/model/ponies/ModelVillagerPony.java +++ b/src/main/java/com/minelittlepony/model/ponies/ModelVillagerPony.java @@ -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