From 782bb86f0c496382a8c8107ed2f064ce24f40178 Mon Sep 17 00:00:00 2001 From: Sollace Date: Mon, 1 Mar 2021 09:42:51 +0200 Subject: [PATCH] Fixed ground pound not triggering properly if the player's fall event doesn't trigger. Closes #29 --- .../unicopia/entity/Living.java | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/minelittlepony/unicopia/entity/Living.java b/src/main/java/com/minelittlepony/unicopia/entity/Living.java index 9ee316f1..3b33fa78 100644 --- a/src/main/java/com/minelittlepony/unicopia/entity/Living.java +++ b/src/main/java/com/minelittlepony/unicopia/entity/Living.java @@ -44,7 +44,11 @@ public abstract class Living implements Equine, Caste } public void waitForFall(Runnable action) { - landEvent = action; + if (entity.isOnGround()) { + action.run(); + } else { + landEvent = action; + } } public boolean sneakingChanged() { @@ -93,10 +97,15 @@ public abstract class Living implements Equine, Caste invinsibilityTicks--; } - prevSneaking = entity.isSneaking(); - prevLanded = entity.isOnGround(); + if (landEvent != null && entity.isOnGround() && landedChanged()) { + landEvent.run(); + landEvent = null; + } enchants.tick(); + + prevSneaking = entity.isSneaking(); + prevLanded = entity.isOnGround(); } @Override @@ -148,10 +157,6 @@ public abstract class Living implements Equine, Caste } protected void handleFall(float distance, float damageMultiplier) { - if (landEvent != null) { - landEvent.run(); - landEvent = null; - } getSpellOrEmpty(DisguiseSpell.class, false).ifPresent(spell -> { spell.getDisguise().onImpact(this, distance, damageMultiplier); });