diff --git a/src/main/java/com/minelittlepony/client/model/part/PonyEars.java b/src/main/java/com/minelittlepony/client/model/part/PonyEars.java index b28841ae..904970d8 100644 --- a/src/main/java/com/minelittlepony/client/model/part/PonyEars.java +++ b/src/main/java/com/minelittlepony/client/model/part/PonyEars.java @@ -3,6 +3,7 @@ package com.minelittlepony.client.model.part; import net.minecraft.client.model.ModelPart; import net.minecraft.client.render.VertexConsumer; import net.minecraft.client.util.math.MatrixStack; +import net.minecraft.util.math.MathHelper; import com.minelittlepony.api.model.IPart; import com.minelittlepony.api.model.ModelAttributes; @@ -25,6 +26,30 @@ public class PonyEars implements IPart, MsonModel { head.addChild("left_ear_" + hashCode(), left); } + @Override + public void setPartAngles(ModelAttributes attributes, float limbAngle, float limbSpeed, float bodySwing, float animationProgress) { + right.resetTransform(); + + limbSpeed = MathHelper.clamp(limbSpeed, 0, 1); + + float forwardFold = 0.14F * limbSpeed; + float sidewaysFlop = 0.11F * limbSpeed; + + right.pitch = forwardFold; + left.pitch = forwardFold; + + right.roll -= sidewaysFlop; + left.roll += sidewaysFlop; + + float floppyness = Math.abs(MathHelper.sin(animationProgress / 99F)); + if (floppyness > 0.99F) { + boolean leftFlop = MathHelper.sin(animationProgress / 5F) > 0.5F; + (leftFlop ? left : right).roll += + 0.01F * MathHelper.sin(animationProgress / 2F) + + 0.015F * MathHelper.cos(animationProgress / 3F); + } + } + @Override public void renderPart(MatrixStack stack, VertexConsumer vertices, int overlayUv, int lightUv, float red, float green, float blue, float alpha, ModelAttributes attributes) { }