Earth Ponies can now sneak to reduce their fall damage

This commit is contained in:
Sollace 2021-09-02 19:17:46 +02:00
parent c0df819a4c
commit ae1f49bd13

View file

@ -332,7 +332,7 @@ public class Pony extends Living<PlayerEntity> implements Transmittable, Copieab
boolean extraProtection = getSpellSlot().get(SpellType.SHIELD, false).isPresent(); boolean extraProtection = getSpellSlot().get(SpellType.SHIELD, false).isPresent();
if (g != 1 || extraProtection || getSpecies().canFly() && !entity.isCreative() && !entity.isSpectator()) { if ((g != 1 || extraProtection) && !entity.isCreative() && !entity.isSpectator()) {
if (extraProtection) { if (extraProtection) {
distance /= (getLevel().get() + 1); distance /= (getLevel().get() + 1);
@ -341,7 +341,11 @@ public class Pony extends Living<PlayerEntity> implements Transmittable, Copieab
} }
} }
distance = Math.max(0, (distance * g) - 5); distance *= g;
if (getSpecies().canFly() || (getSpecies().canUseEarth() && entity.isSneaking())) {
distance -= 5;
}
distance = Math.max(0, distance);
handleFall(distance, damageMultiplier, cause); handleFall(distance, damageMultiplier, cause);
return Optional.of(distance); return Optional.of(distance);