mirror of
https://github.com/Sollace/Unicopia.git
synced 2025-02-19 19:34:23 +01:00
Fixed ground pound not triggering properly if the player's fall event doesn't trigger. Closes #29
This commit is contained in:
parent
0cd45ad1ae
commit
782bb86f0c
1 changed files with 12 additions and 7 deletions
|
@ -44,7 +44,11 @@ public abstract class Living<T extends LivingEntity> implements Equine<T>, Caste
|
||||||
}
|
}
|
||||||
|
|
||||||
public void waitForFall(Runnable action) {
|
public void waitForFall(Runnable action) {
|
||||||
landEvent = action;
|
if (entity.isOnGround()) {
|
||||||
|
action.run();
|
||||||
|
} else {
|
||||||
|
landEvent = action;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean sneakingChanged() {
|
public boolean sneakingChanged() {
|
||||||
|
@ -93,10 +97,15 @@ public abstract class Living<T extends LivingEntity> implements Equine<T>, Caste
|
||||||
invinsibilityTicks--;
|
invinsibilityTicks--;
|
||||||
}
|
}
|
||||||
|
|
||||||
prevSneaking = entity.isSneaking();
|
if (landEvent != null && entity.isOnGround() && landedChanged()) {
|
||||||
prevLanded = entity.isOnGround();
|
landEvent.run();
|
||||||
|
landEvent = null;
|
||||||
|
}
|
||||||
|
|
||||||
enchants.tick();
|
enchants.tick();
|
||||||
|
|
||||||
|
prevSneaking = entity.isSneaking();
|
||||||
|
prevLanded = entity.isOnGround();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -148,10 +157,6 @@ public abstract class Living<T extends LivingEntity> implements Equine<T>, Caste
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void handleFall(float distance, float damageMultiplier) {
|
protected void handleFall(float distance, float damageMultiplier) {
|
||||||
if (landEvent != null) {
|
|
||||||
landEvent.run();
|
|
||||||
landEvent = null;
|
|
||||||
}
|
|
||||||
getSpellOrEmpty(DisguiseSpell.class, false).ifPresent(spell -> {
|
getSpellOrEmpty(DisguiseSpell.class, false).ifPresent(spell -> {
|
||||||
spell.getDisguise().onImpact(this, distance, damageMultiplier);
|
spell.getDisguise().onImpact(this, distance, damageMultiplier);
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue