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

Paper Changes:
PaperMC/Paper@996d529 Resend entity using the bundle packet (#9853)
PaperMC/Paper@8cf2503 Updated Upstream (Bukkit/CraftBukkit) (#9876)
PaperMC/Paper@2935067 Fix null item in sendEquipmentChange (#9869)
PaperMC/Paper@b3cac04 Fix crash when version_history.json is empty (#9871)
PaperMC/Paper@b1faa5d Fix PotionAPI ignores icon flag (#9864)
PaperMC/Paper@52849f6 Cleanup disable explosion knockback patch (#9858)
PaperMC/Paper@8b1ac39 Fix warden spawn reason from DEFAULT to NATURAL (#8744)
PaperMC/Paper@c6fac38 fix UnsafeValues#loadAdvancement doesn't recalculate position (#9846)
PaperMC/Paper@5bdfb29 Add player idle duration API (#9833)
PaperMC/Paper@a81a384 Implement Velocity VarInt optimizations (#8418)
PaperMC/Paper@415d708 [ci skip] Fix author in last patch
PaperMC/Paper@3e4eaf2 [ci skip] Fix module derp
PaperMC/Paper@5bb30ce Fix entity camera not being reset when cancelling spectating start/stop events (#9883)
PaperMC/Paper@1865625 Fix NPE when no valid world is found on legacy Players (#9885)
2023-10-29 12:39:53 -07:00

92 lines
4.7 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 63917cc4efb9d5a21d83e263c315adc6f5fdb04e..1d8d5cdb1604d852bf72d16e29e7a74caded5692 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -253,6 +253,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
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;
@@ -353,7 +354,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
this.tryAddSoulSpeed();
}
- if (!this.level().isClientSide && this.fallDistance > 3.0F && onGround && !state.isAir()) {
+ if (!this.level().isClientSide && this.fallDistance > this.safeFallDistance && onGround && !state.isAir()) { // Purpur
double d1 = this.getX();
double d2 = this.getY();
double d3 = this.getZ();
@@ -368,7 +369,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
d3 = (double) landedPosition.getZ() + 0.5D + d5 / d6 * 0.5D;
}
- float f = (float) Mth.ceil(this.fallDistance - 3.0F);
+ float f = (float) Mth.ceil(this.fallDistance - this.safeFallDistance); // Purpur
double d7 = Math.min((double) (0.2F + f / 15.0F), 2.5D);
int i = (int) (150.0D * d7);
@@ -2089,7 +2090,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
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
}
}
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 ad4d4e38a2f0125e0943945c9440a9be80b60257..d3b655ccf40d24b7f5a09383fd5771bb275ac4b7 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
@@ -386,7 +386,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 2a30499fd6f4a1340f6911f0f7f079bcbe8576a3..c3c0fbe71c9af1125c80698865cb9eaf42d4a1c5 100644
--- a/src/main/java/net/minecraft/world/entity/monster/Giant.java
+++ b/src/main/java/net/minecraft/world/entity/monster/Giant.java
@@ -13,6 +13,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 2be45534feedb77c44fbd736f2725b97b3840b41..231603683dee2e7ceeb551bd3cb331f98fb32bde 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
@@ -1099,4 +1099,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
}