From d057e09877c32e27680d8f76f60bb9a80e22a6e8 Mon Sep 17 00:00:00 2001 From: Sollace Date: Thu, 8 Oct 2020 19:36:15 +0200 Subject: [PATCH] Shields will now reduce the amound of fall damage you take --- .../minelittlepony/unicopia/entity/player/Pony.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/minelittlepony/unicopia/entity/player/Pony.java b/src/main/java/com/minelittlepony/unicopia/entity/player/Pony.java index e1e8c743..e7de0ace 100644 --- a/src/main/java/com/minelittlepony/unicopia/entity/player/Pony.java +++ b/src/main/java/com/minelittlepony/unicopia/entity/player/Pony.java @@ -13,6 +13,7 @@ import com.minelittlepony.unicopia.ability.AbilityDispatcher; import com.minelittlepony.unicopia.ability.magic.Attached; import com.minelittlepony.unicopia.ability.magic.Caster; import com.minelittlepony.unicopia.ability.magic.Spell; +import com.minelittlepony.unicopia.ability.magic.spell.ShieldSpell; import com.minelittlepony.unicopia.ability.magic.spell.SpellRegistry; import com.minelittlepony.unicopia.entity.Physics; import com.minelittlepony.unicopia.entity.PonyContainer; @@ -326,7 +327,16 @@ public class Pony implements Caster, Equine, Transmi float g = gravity.getGravityModifier(); - if (g != 1 || getSpecies().canFly() && !entity.isCreative() && !entity.isSpectator()) { + boolean extraProtection = getSpell(ShieldSpell.class, false) != null; + + if (g != 1 || extraProtection || getSpecies().canFly() && !entity.isCreative() && !entity.isSpectator()) { + + if (extraProtection) { + distance /= (getLevel().get() + 1); + if (entity.isSneaking()) { + distance /= 2; + } + } distance *= g;