diff --git a/src/main/java/com/minelittlepony/ducks/IPonyAnimationHolder.java b/src/main/java/com/minelittlepony/ducks/IPonyAnimationHolder.java index 9d91c168..2fd0c4f5 100644 --- a/src/main/java/com/minelittlepony/ducks/IPonyAnimationHolder.java +++ b/src/main/java/com/minelittlepony/ducks/IPonyAnimationHolder.java @@ -8,5 +8,7 @@ public interface IPonyAnimationHolder { /** * Updates and gets the amount this entity is strafing to each side. */ - float getStrafeAmount(float ticks); + float getStrafeAmount(); + + void setStrafeAmount(float strafeAmount); } diff --git a/src/main/java/com/minelittlepony/mixin/MixinEntityLivingBase.java b/src/main/java/com/minelittlepony/mixin/MixinEntityLivingBase.java index f0646c58..078e4f91 100644 --- a/src/main/java/com/minelittlepony/mixin/MixinEntityLivingBase.java +++ b/src/main/java/com/minelittlepony/mixin/MixinEntityLivingBase.java @@ -1,7 +1,6 @@ package com.minelittlepony.mixin; import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.Shadow; import com.minelittlepony.ducks.IPonyAnimationHolder; @@ -11,9 +10,6 @@ import net.minecraft.world.World; @Mixin(EntityLivingBase.class) public abstract class MixinEntityLivingBase extends Entity implements IPonyAnimationHolder { - @Shadow - public float moveStrafing; - private MixinEntityLivingBase(World worldIn) { super(worldIn); } @@ -24,16 +20,12 @@ public abstract class MixinEntityLivingBase extends Entity implements IPonyAnima private float strafeRollAmount = 0; @Override - public float getStrafeAmount(float ticks) { - float strafing = moveStrafing; - if (strafing != 0) { - if (Math.abs(strafeRollAmount) < Math.abs(strafing)) { - strafeRollAmount += strafing/10; - } - } else { - strafeRollAmount *= 0.8; - } + public float getStrafeAmount() { + return strafeRollAmount; + } - return (float)Math.toDegrees(strafeRollAmount); + @Override + public void setStrafeAmount(float strafeAmount) { + strafeRollAmount = strafeAmount; } } diff --git a/src/main/java/com/minelittlepony/render/player/RenderPonyPlayer.java b/src/main/java/com/minelittlepony/render/player/RenderPonyPlayer.java index 793cd758..519d0cd7 100644 --- a/src/main/java/com/minelittlepony/render/player/RenderPonyPlayer.java +++ b/src/main/java/com/minelittlepony/render/player/RenderPonyPlayer.java @@ -50,7 +50,21 @@ public class RenderPonyPlayer extends RenderPonyBase { ponyModel.motionPitch = (float) Math.toDegrees(angle); GlStateManager.rotate(ponyModel.motionPitch, 1, 0, 0); - GlStateManager.rotate(((IPonyAnimationHolder)player).getStrafeAmount(ticks), 0, 0, 1); + + + float lastStrafe = ((IPonyAnimationHolder)player).getStrafeAmount(); + + float strafing = player.moveStrafing; + if (strafing != 0) { + if (Math.abs(lastStrafe) < Math.abs(strafing)) { + lastStrafe += strafing/10; + } + } else { + lastStrafe *= 0.8; + } + + ((IPonyAnimationHolder)player).setStrafeAmount(lastStrafe); + GlStateManager.rotate((float)Math.toDegrees(lastStrafe), 0, 0, 1); } //TODO: MC1.13 transformSwimming()