mirror of
https://github.com/MineLittlePony/MineLittlePony.git
synced 2024-11-23 04:57:58 +01:00
(From the capes branch) Let's be a bit more sensible about flying
This commit is contained in:
parent
72b3bce950
commit
8e1fb834f7
4 changed files with 5 additions and 19 deletions
|
@ -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
|
||||||
|
|
|
@ -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.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -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) {
|
||||||
|
|
|
@ -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);
|
||||||
|
|
Loading…
Reference in a new issue