Files
Purpur/patches/server/0015-LivingEntity-safeFallDistance.patch
BillyGalbreath 47dc2e92f5 Updated Upstream (Paper)
Upstream has released updates that appear to apply and compile correctly

Paper Changes:
PaperMC/Paper@55a16d8 Fix Varint21FrameDecoder cached length buf usage
PaperMC/Paper@e6e37ba Add api to resolve components (#7648)
PaperMC/Paper@7168438 [ci skip] Rework workflows to support optional paperclip build (#8583)
PaperMC/Paper@da230d5 More vanilla friendly methods to update trades (#8478)
PaperMC/Paper@8aff07a Add /paper dumplisteners command (#8507)
PaperMC/Paper@b8919a7 pr command action fixes (#8591)
PaperMC/Paper@185fa48 Fix chest relooting mechanics (#8580)
PaperMC/Paper@b4beac0 Fixes potential issues arising from optimizing getPlayerByUUID (#8585)
PaperMC/Paper@f637b1a Fix async entity add due to fungus trees (#7626)
PaperMC/Paper@414ea80 ItemStack damage API (#7801)
PaperMC/Paper@d98c370 Add displayName methods for advancements (#8584)
PaperMC/Paper@44bb599 Add Tick TemporalUnit (#5445)
PaperMC/Paper@9f7eef8 Friction API (#6611)
PaperMC/Paper@4048d3e Allow using degrees for ArmorStand rotations (#7847)
PaperMC/Paper@f59c802 Schoolable Fish API (#7089)
PaperMC/Paper@21b964a Added ability to control player's insomnia and phantoms spawning (#6500)
PaperMC/Paper@f1583fc Add `/paper dumplisteners tofile` and increase detail of command output (#8592)
2022-11-26 18:48:36 -06:00

85 lines
4.3 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: William Blake Galbreath <Blake.Galbreath@GMail.com>
Date: Sun, 5 May 2019 12:58:45 -0500
Subject: [PATCH] LivingEntity safeFallDistance
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index 86dfb5537f1da7f1e2b8e9bfeb43111b0ac16228..da4fe84f640eacc7c1c3da9a6adee4824c1d10fa 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -255,6 +255,7 @@ public abstract class LivingEntity extends Entity {
private boolean skipDropExperience;
// CraftBukkit start
public int expToDrop;
+ public float safeFallDistance = 3.0F; // Purpur
public boolean forceDrops;
public ArrayList<org.bukkit.inventory.ItemStack> drops = new ArrayList<org.bukkit.inventory.ItemStack>();
public final org.bukkit.craftbukkit.attribute.CraftAttributeMap craftAttributes;
@@ -355,8 +356,8 @@ public abstract class LivingEntity extends Entity {
this.tryAddSoulSpeed();
}
- if (!this.level.isClientSide && this.fallDistance > 3.0F && onGround) {
- float f = (float) Mth.ceil(this.fallDistance - 3.0F);
+ if (!this.level.isClientSide && this.fallDistance > this.safeFallDistance && onGround) { // Purpur
+ float f = (float) Mth.ceil(this.fallDistance - this.safeFallDistance); // Purpur
if (!state.isAir()) {
double d1 = Math.min((double) (0.2F + f / 15.0F), 2.5D);
@@ -2006,7 +2007,7 @@ public abstract class LivingEntity extends Entity {
MobEffectInstance mobeffect = this.getEffect(MobEffects.JUMP);
float f2 = mobeffect == null ? 0.0F : (float) (mobeffect.getAmplifier() + 1);
- return Mth.ceil((fallDistance - 3.0F - f2) * damageMultiplier);
+ return Mth.ceil((fallDistance - this.safeFallDistance - f2) * damageMultiplier); // Purpur
}
protected void playBlockFallSound() {
diff --git a/src/main/java/net/minecraft/world/entity/animal/horse/AbstractHorse.java b/src/main/java/net/minecraft/world/entity/animal/horse/AbstractHorse.java
index 075c668b6855dd44102bf521864133565fcf16db..a1ffa88c3796df2973a2fc0aeafda5f78208bf85 100644
--- a/src/main/java/net/minecraft/world/entity/animal/horse/AbstractHorse.java
+++ b/src/main/java/net/minecraft/world/entity/animal/horse/AbstractHorse.java
@@ -325,7 +325,7 @@ public abstract class AbstractHorse extends Animal implements ContainerListener,
@Override
protected int calculateFallDamage(float fallDistance, float damageMultiplier) {
- return Mth.ceil((fallDistance * 0.5F - 3.0F) * damageMultiplier);
+ return Mth.ceil((fallDistance * 0.5F - this.safeFallDistance) * damageMultiplier);
}
protected int getInventorySize() {
diff --git a/src/main/java/net/minecraft/world/entity/monster/Giant.java b/src/main/java/net/minecraft/world/entity/monster/Giant.java
index 8b1942b396606f0c989645a6ac587fbdd26a3dc5..c1c5e884f00398032196ee71b55b348fcfce21ce 100644
--- a/src/main/java/net/minecraft/world/entity/monster/Giant.java
+++ b/src/main/java/net/minecraft/world/entity/monster/Giant.java
@@ -12,6 +12,7 @@ import net.minecraft.world.level.LevelReader;
public class Giant extends Monster {
public Giant(EntityType<? extends Giant> type, Level world) {
super(type, world);
+ this.safeFallDistance = 10.0F; // Purpur
}
// Purpur start
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
index e3c1a7f7e643b8a2f42e76c92087219f984ea8aa..810e13a060a7c64f8d0d08a632b378ef8480710e 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
@@ -1043,4 +1043,16 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
getHandle().knockback(strength, directionX, directionZ);
};
// Paper end
+
+ // Purpur start
+ @Override
+ public float getSafeFallDistance() {
+ return getHandle().safeFallDistance;
+ }
+
+ @Override
+ public void setSafeFallDistance(float safeFallDistance) {
+ getHandle().safeFallDistance = safeFallDistance;
+ }
+ // Purpur end
}