(From the capes branch) Let's be a bit more sensible about flying

This commit is contained in:
Sollace 2018-05-10 18:34:55 +02:00
parent 72b3bce950
commit 8e1fb834f7
4 changed files with 5 additions and 19 deletions

View file

@ -17,7 +17,6 @@ import net.minecraft.client.model.ModelPlayer;
import net.minecraft.client.model.ModelRenderer; import net.minecraft.client.model.ModelRenderer;
import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.util.EnumHandSide; import net.minecraft.util.EnumHandSide;
import net.minecraft.util.math.MathHelper; 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. * 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) { 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) { protected void setLegs(float move, float swing, float ticks, Entity entity) {
if (isFlying(entity)) { if (isFlying()) {
rotateLegsInFlight(move, swing, ticks, entity); rotateLegsInFlight(move, swing, ticks, entity);
} else { } else {
rotateLegsOnGround(move, swing, ticks, entity); rotateLegsOnGround(move, swing, ticks, entity);
@ -675,12 +674,6 @@ public abstract class AbstractPonyModel extends ModelPlayer implements IModel {
return !rainboom && isSneak && !isFlying; return !rainboom && isSneak && !isFlying;
} }
@Override
public boolean isFlying(Entity entity) {
return (isFlying && canFly()) ||
(entity instanceof EntityLivingBase && ((EntityLivingBase) entity).isElytraFlying());
}
@Override @Override
public boolean isGoingFast() { public boolean isGoingFast() {
return rainboom; return rainboom;
@ -688,7 +681,7 @@ public abstract class AbstractPonyModel extends ModelPlayer implements IModel {
@Override @Override
public boolean isFlying() { public boolean isFlying() {
return isFlying; return isFlying && canFly();
} }
@Override @Override

View file

@ -4,8 +4,6 @@ import com.minelittlepony.model.BodyPart;
import com.minelittlepony.model.armour.PonyArmor; import com.minelittlepony.model.armour.PonyArmor;
import com.minelittlepony.pony.data.IPonyData; import com.minelittlepony.pony.data.IPonyData;
import net.minecraft.entity.Entity;
public interface IModel { public interface IModel {
/** /**
@ -33,11 +31,6 @@ public interface IModel {
*/ */
boolean isCrouching(); 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. * Returns true if the model is flying.
*/ */

View file

@ -100,7 +100,7 @@ public class Pony {
//noinspection SimplifiableIfStatement //noinspection SimplifiableIfStatement
if (!getRace(false).hasWings()) return false; 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) { public ModelWrapper getModel(boolean ignorePony) {

View file

@ -53,7 +53,7 @@ public abstract class RenderPonyMob<T extends EntityLiving> extends RenderLiving
@Override @Override
protected void preRenderCallback(T entity, float ticks) { protected void preRenderCallback(T entity, float ticks) {
playerModel.getModel().isSneak = entity.isSneaking(); playerModel.getModel().isSneak = entity.isSneaking();
playerModel.getModel().isFlying = !entity.onGround; playerModel.getModel().isFlying = !entity.onGround || entity.isElytraFlying();
playerModel.getModel().isSleeping = false; playerModel.getModel().isSleeping = false;
ResourceLocation loc = getEntityTexture(entity); ResourceLocation loc = getEntityTexture(entity);