From 8e1fb834f7b89174c0ca00dc729cd70df13b46a5 Mon Sep 17 00:00:00 2001 From: Sollace Date: Thu, 10 May 2018 18:34:55 +0200 Subject: [PATCH] (From the capes branch) Let's be a bit more sensible about flying --- .../com/minelittlepony/model/AbstractPonyModel.java | 13 +++---------- .../minelittlepony/model/capabilities/IModel.java | 7 ------- .../java/com/minelittlepony/pony/data/Pony.java | 2 +- .../com/minelittlepony/render/RenderPonyMob.java | 2 +- 4 files changed, 5 insertions(+), 19 deletions(-) diff --git a/src/main/java/com/minelittlepony/model/AbstractPonyModel.java b/src/main/java/com/minelittlepony/model/AbstractPonyModel.java index 7372ae7f..93393814 100644 --- a/src/main/java/com/minelittlepony/model/AbstractPonyModel.java +++ b/src/main/java/com/minelittlepony/model/AbstractPonyModel.java @@ -17,7 +17,6 @@ import net.minecraft.client.model.ModelPlayer; import net.minecraft.client.model.ModelRenderer; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityLivingBase; import net.minecraft.util.EnumHandSide; import net.minecraft.util.math.MathHelper; @@ -73,7 +72,7 @@ public abstract class AbstractPonyModel extends ModelPlayer implements IModel { * Checks flying and speed conditions and sets rainboom to true if we're a species with wings and is going faaast. */ protected void checkRainboom(Entity entity, float swing) { - rainboom = canFly() && isFlying(entity) && swing >= 0.9999F; + rainboom = isFlying() && swing >= 0.9999F; } /** @@ -213,7 +212,7 @@ public abstract class AbstractPonyModel extends ModelPlayer implements IModel { * */ protected void setLegs(float move, float swing, float ticks, Entity entity) { - if (isFlying(entity)) { + if (isFlying()) { rotateLegsInFlight(move, swing, ticks, entity); } else { rotateLegsOnGround(move, swing, ticks, entity); @@ -675,12 +674,6 @@ public abstract class AbstractPonyModel extends ModelPlayer implements IModel { return !rainboom && isSneak && !isFlying; } - @Override - public boolean isFlying(Entity entity) { - return (isFlying && canFly()) || - (entity instanceof EntityLivingBase && ((EntityLivingBase) entity).isElytraFlying()); - } - @Override public boolean isGoingFast() { return rainboom; @@ -688,7 +681,7 @@ public abstract class AbstractPonyModel extends ModelPlayer implements IModel { @Override public boolean isFlying() { - return isFlying; + return isFlying && canFly(); } @Override diff --git a/src/main/java/com/minelittlepony/model/capabilities/IModel.java b/src/main/java/com/minelittlepony/model/capabilities/IModel.java index 38638a93..193caa6a 100644 --- a/src/main/java/com/minelittlepony/model/capabilities/IModel.java +++ b/src/main/java/com/minelittlepony/model/capabilities/IModel.java @@ -4,8 +4,6 @@ import com.minelittlepony.model.BodyPart; import com.minelittlepony.model.armour.PonyArmor; import com.minelittlepony.pony.data.IPonyData; -import net.minecraft.entity.Entity; - public interface IModel { /** @@ -33,11 +31,6 @@ public interface IModel { */ boolean isCrouching(); - /** - * Returns true if the given entity can and is flying, or has an elytra. - */ - boolean isFlying(Entity entity); - /** * Returns true if the model is flying. */ diff --git a/src/main/java/com/minelittlepony/pony/data/Pony.java b/src/main/java/com/minelittlepony/pony/data/Pony.java index 270e3d1e..7d17eb5f 100644 --- a/src/main/java/com/minelittlepony/pony/data/Pony.java +++ b/src/main/java/com/minelittlepony/pony/data/Pony.java @@ -100,7 +100,7 @@ public class Pony { //noinspection SimplifiableIfStatement if (!getRace(false).hasWings()) return false; - return player.capabilities.isFlying || !(player.onGround || player.isRiding() || player.isOnLadder() || player.isInWater() || player.isElytraFlying()); + return player.capabilities.isFlying || !(player.onGround || player.isRiding() || player.isOnLadder() || player.isInWater()); } public ModelWrapper getModel(boolean ignorePony) { diff --git a/src/main/java/com/minelittlepony/render/RenderPonyMob.java b/src/main/java/com/minelittlepony/render/RenderPonyMob.java index 0efe0f9e..5513e416 100644 --- a/src/main/java/com/minelittlepony/render/RenderPonyMob.java +++ b/src/main/java/com/minelittlepony/render/RenderPonyMob.java @@ -53,7 +53,7 @@ public abstract class RenderPonyMob extends RenderLiving @Override protected void preRenderCallback(T entity, float ticks) { playerModel.getModel().isSneak = entity.isSneaking(); - playerModel.getModel().isFlying = !entity.onGround; + playerModel.getModel().isFlying = !entity.onGround || entity.isElytraFlying(); playerModel.getModel().isSleeping = false; ResourceLocation loc = getEntityTexture(entity);