mirror of
https://github.com/MineLittlePony/MineLittlePony.git
synced 2024-11-29 23:48:00 +01:00
Moved render logic out of the entity mixin even though it's actually entity logic.
This commit is contained in:
parent
7e183e3247
commit
a639afea59
3 changed files with 24 additions and 16 deletions
|
@ -8,5 +8,7 @@ public interface IPonyAnimationHolder {
|
||||||
/**
|
/**
|
||||||
* Updates and gets the amount this entity is strafing to each side.
|
* Updates and gets the amount this entity is strafing to each side.
|
||||||
*/
|
*/
|
||||||
float getStrafeAmount(float ticks);
|
float getStrafeAmount();
|
||||||
|
|
||||||
|
void setStrafeAmount(float strafeAmount);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package com.minelittlepony.mixin;
|
package com.minelittlepony.mixin;
|
||||||
|
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
import org.spongepowered.asm.mixin.Shadow;
|
|
||||||
|
|
||||||
import com.minelittlepony.ducks.IPonyAnimationHolder;
|
import com.minelittlepony.ducks.IPonyAnimationHolder;
|
||||||
|
|
||||||
|
@ -11,9 +10,6 @@ import net.minecraft.world.World;
|
||||||
|
|
||||||
@Mixin(EntityLivingBase.class)
|
@Mixin(EntityLivingBase.class)
|
||||||
public abstract class MixinEntityLivingBase extends Entity implements IPonyAnimationHolder {
|
public abstract class MixinEntityLivingBase extends Entity implements IPonyAnimationHolder {
|
||||||
@Shadow
|
|
||||||
public float moveStrafing;
|
|
||||||
|
|
||||||
private MixinEntityLivingBase(World worldIn) {
|
private MixinEntityLivingBase(World worldIn) {
|
||||||
super(worldIn);
|
super(worldIn);
|
||||||
}
|
}
|
||||||
|
@ -24,16 +20,12 @@ public abstract class MixinEntityLivingBase extends Entity implements IPonyAnima
|
||||||
private float strafeRollAmount = 0;
|
private float strafeRollAmount = 0;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public float getStrafeAmount(float ticks) {
|
public float getStrafeAmount() {
|
||||||
float strafing = moveStrafing;
|
return strafeRollAmount;
|
||||||
if (strafing != 0) {
|
}
|
||||||
if (Math.abs(strafeRollAmount) < Math.abs(strafing)) {
|
|
||||||
strafeRollAmount += strafing/10;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
strafeRollAmount *= 0.8;
|
|
||||||
}
|
|
||||||
|
|
||||||
return (float)Math.toDegrees(strafeRollAmount);
|
@Override
|
||||||
|
public void setStrafeAmount(float strafeAmount) {
|
||||||
|
strafeRollAmount = strafeAmount;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,7 +50,21 @@ public class RenderPonyPlayer extends RenderPonyBase {
|
||||||
ponyModel.motionPitch = (float) Math.toDegrees(angle);
|
ponyModel.motionPitch = (float) Math.toDegrees(angle);
|
||||||
|
|
||||||
GlStateManager.rotate(ponyModel.motionPitch, 1, 0, 0);
|
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()
|
//TODO: MC1.13 transformSwimming()
|
||||||
|
|
Loading…
Reference in a new issue