From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: TreyRuffy Date: Fri, 27 May 2022 02:26:08 -0600 Subject: [PATCH] Flying Fall Damage diff --git a/src/main/java/net/minecraft/world/entity/player/Player.java b/src/main/java/net/minecraft/world/entity/player/Player.java index 5b772b3caeafe98aa45a01bffe215a5dd33323b6..0629c471d38a77c44fc1c86ccdfcb0690f61ca17 100644 --- a/src/main/java/net/minecraft/world/entity/player/Player.java +++ b/src/main/java/net/minecraft/world/entity/player/Player.java @@ -184,6 +184,7 @@ public abstract class Player extends LivingEntity { public float hurtDir; // Paper - protected -> public // Paper start public boolean affectsSpawning = true; + public net.kyori.adventure.util.TriState flyingFallDamage = net.kyori.adventure.util.TriState.NOT_SET; // Paper end // CraftBukkit start @@ -1754,7 +1755,7 @@ public abstract class Player extends LivingEntity { @Override public boolean causeFallDamage(float fallDistance, float damageMultiplier, DamageSource damageSource) { - if (this.abilities.mayfly) { + if (this.abilities.mayfly && !this.flyingFallDamage.toBooleanOrElse(false)) { // Paper - flying fall damage return false; } else { if (fallDistance >= 2.0F) { diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java index 63f8a92cadfecc2d0e5256c5de822fe86d5ed91b..cdb1e5d82ff1e18e3f27c816df57bd9eeebbe80b 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -2291,6 +2291,19 @@ public class CraftPlayer extends CraftHumanEntity implements Player { this.getHandle().onUpdateAbilities(); } + // Paper start - flying fall damage + @Override + public void setFlyingFallDamage(@NotNull net.kyori.adventure.util.TriState flyingFallDamage) { + getHandle().flyingFallDamage = flyingFallDamage; + } + + @NotNull + @Override + public net.kyori.adventure.util.TriState hasFlyingFallDamage() { + return getHandle().flyingFallDamage; + } + // Paper end + @Override public int getNoDamageTicks() { if (this.getHandle().spawnInvulnerableTime > 0) {