mirror of
https://github.com/Sollace/Unicopia.git
synced 2025-02-25 06:04:32 +01:00
Fixed modified fall damage
This commit is contained in:
parent
9f33c7d881
commit
7a3a441cb6
1 changed files with 7 additions and 6 deletions
|
@ -328,11 +328,13 @@ public class Pony extends Living<PlayerEntity> implements Transmittable, Copieab
|
||||||
|
|
||||||
public Optional<Float> onImpact(float distance, float damageMultiplier, DamageSource cause) {
|
public Optional<Float> onImpact(float distance, float damageMultiplier, DamageSource cause) {
|
||||||
|
|
||||||
float g = gravity.getGravityModifier();
|
float originalDistance = distance;
|
||||||
|
|
||||||
|
distance *= gravity.getGravityModifier();
|
||||||
|
|
||||||
boolean extraProtection = getSpellSlot().get(SpellType.SHIELD, false).isPresent();
|
boolean extraProtection = getSpellSlot().get(SpellType.SHIELD, false).isPresent();
|
||||||
|
|
||||||
if ((g != 1 || extraProtection) && !entity.isCreative() && !entity.isSpectator()) {
|
if (!entity.isCreative() && !entity.isSpectator()) {
|
||||||
|
|
||||||
if (extraProtection) {
|
if (extraProtection) {
|
||||||
distance /= (getLevel().get() + 1);
|
distance /= (getLevel().get() + 1);
|
||||||
|
@ -341,17 +343,16 @@ public class Pony extends Living<PlayerEntity> implements Transmittable, Copieab
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
distance *= g;
|
|
||||||
if (getSpecies().canFly() || (getSpecies().canUseEarth() && entity.isSneaking())) {
|
if (getSpecies().canFly() || (getSpecies().canUseEarth() && entity.isSneaking())) {
|
||||||
distance -= 5;
|
distance -= 5;
|
||||||
}
|
}
|
||||||
distance = Math.max(0, distance);
|
distance = Math.max(0, distance);
|
||||||
|
|
||||||
handleFall(distance, damageMultiplier, cause);
|
|
||||||
return Optional.of(distance);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
handleFall(distance, damageMultiplier, cause);
|
handleFall(distance, damageMultiplier, cause);
|
||||||
|
if (distance != originalDistance) {
|
||||||
|
return Optional.of(distance);
|
||||||
|
}
|
||||||
return Optional.empty();
|
return Optional.empty();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue