mirror of
https://github.com/MineLittlePony/MineLittlePony.git
synced 2025-02-13 16:24:23 +01:00
Elytra flying is different from regular flying
This commit is contained in:
parent
21ea56d134
commit
1369665fd6
3 changed files with 20 additions and 3 deletions
|
@ -35,6 +35,7 @@ public abstract class AbstractPonyModel extends ModelPlayer implements IModel {
|
||||||
|
|
||||||
private boolean isSleeping;
|
private boolean isSleeping;
|
||||||
private boolean isFlying;
|
private boolean isFlying;
|
||||||
|
private boolean isElytraFlying;
|
||||||
private boolean isSwimming;
|
private boolean isSwimming;
|
||||||
private boolean headGear;
|
private boolean headGear;
|
||||||
|
|
||||||
|
@ -72,7 +73,8 @@ 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() && Math.sqrt(entity.motionX * entity.motionX + entity.motionZ * entity.motionZ) > 0.4F;
|
rainboom = canFly() || isElytraFlying();
|
||||||
|
rainboom &= Math.sqrt(entity.motionX * entity.motionX + entity.motionZ * entity.motionZ) > 0.4F;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateLivingState(EntityLivingBase entity, Pony pony) {
|
public void updateLivingState(EntityLivingBase entity, Pony pony) {
|
||||||
|
@ -80,6 +82,7 @@ public abstract class AbstractPonyModel extends ModelPlayer implements IModel {
|
||||||
isSneak = entity.isSneaking();
|
isSneak = entity.isSneaking();
|
||||||
isSleeping = entity.isPlayerSleeping();
|
isSleeping = entity.isPlayerSleeping();
|
||||||
isFlying = pony.isPegasusFlying(entity);
|
isFlying = pony.isPegasusFlying(entity);
|
||||||
|
isElytraFlying = entity.isElytraFlying();
|
||||||
isSwimming = pony.isSwimming(entity);
|
isSwimming = pony.isSwimming(entity);
|
||||||
headGear = pony.isWearingHeadgear(entity);
|
headGear = pony.isWearingHeadgear(entity);
|
||||||
}
|
}
|
||||||
|
@ -224,7 +227,7 @@ public abstract class AbstractPonyModel extends ModelPlayer implements IModel {
|
||||||
protected void rotateLegs(float move, float swing, float ticks, Entity entity) {
|
protected void rotateLegs(float move, float swing, float ticks, Entity entity) {
|
||||||
if (isSwimming()) {
|
if (isSwimming()) {
|
||||||
rotateLegsSwimming(move, swing, ticks, entity);
|
rotateLegsSwimming(move, swing, ticks, entity);
|
||||||
} else if (isFlying()) {
|
} else if (isGoingFast()) {
|
||||||
rotateLegsInFlight(move, swing, ticks, entity);
|
rotateLegsInFlight(move, swing, ticks, entity);
|
||||||
} else {
|
} else {
|
||||||
rotateLegsOnGround(move, swing, ticks, entity);
|
rotateLegsOnGround(move, swing, ticks, entity);
|
||||||
|
@ -692,6 +695,11 @@ public abstract class AbstractPonyModel extends ModelPlayer implements IModel {
|
||||||
return isFlying && canFly();
|
return isFlying && canFly();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isElytraFlying() {
|
||||||
|
return isElytraFlying;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isSleeping() {
|
public boolean isSleeping() {
|
||||||
return isSleeping;
|
return isSleeping;
|
||||||
|
@ -849,6 +857,8 @@ public abstract class AbstractPonyModel extends ModelPlayer implements IModel {
|
||||||
if (model instanceof AbstractPonyModel) {
|
if (model instanceof AbstractPonyModel) {
|
||||||
AbstractPonyModel pony = (AbstractPonyModel) model;
|
AbstractPonyModel pony = (AbstractPonyModel) model;
|
||||||
isFlying = pony.isFlying;
|
isFlying = pony.isFlying;
|
||||||
|
isElytraFlying = pony.isElytraFlying;
|
||||||
|
isSwimming = pony.isSwimming;
|
||||||
isSleeping = pony.isSleeping;
|
isSleeping = pony.isSleeping;
|
||||||
metadata = pony.metadata;
|
metadata = pony.metadata;
|
||||||
motionPitch = pony.motionPitch;
|
motionPitch = pony.motionPitch;
|
||||||
|
|
|
@ -39,6 +39,12 @@ public interface IModel extends ICapitated {
|
||||||
*/
|
*/
|
||||||
boolean isFlying();
|
boolean isFlying();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns true if the model is elytra flying. Elytra flying is different
|
||||||
|
* from regular flying in that there are actual "wings" involved.
|
||||||
|
*/
|
||||||
|
boolean isElytraFlying();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns true if this model is lying on a bed or bed-like object.
|
* Returns true if this model is lying on a bed or bed-like object.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -6,11 +6,12 @@ import static com.minelittlepony.model.PonyModelConstants.ROTATE_270;
|
||||||
import net.minecraft.util.math.MathHelper;
|
import net.minecraft.util.math.MathHelper;
|
||||||
|
|
||||||
public interface IModelPegasus extends IModel {
|
public interface IModelPegasus extends IModel {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns true if the wings are spread.
|
* Returns true if the wings are spread.
|
||||||
*/
|
*/
|
||||||
default boolean wingsAreOpen() {
|
default boolean wingsAreOpen() {
|
||||||
return isSwimming() || isFlying() || isCrouching();
|
return (isSwimming() || isFlying() || isCrouching()) && !isElytraFlying();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue