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

Paper Changes:
PaperMC/Paper@0baf2ff [ci skip] Allow .git to be a regular file (#8631)
PaperMC/Paper@5e6ac3c Properly identify golem spawn reason (#8635)
PaperMC/Paper@ec772bb Rabbit API (#8627)
PaperMC/Paper@7e5f85e Updated Upstream (CraftBukkit)
PaperMC/Paper@075fb67 Add eating regain reason for Camels (#8638)
PaperMC/Paper@812efd3 Fix chunksnapshot biome getter (#8639)
PaperMC/Paper@be50d5b Readd BlockBehavior inlining patch
PaperMC/Paper@7ba81b1 [ci skip] Fix leaf'd patch names
PaperMC/Paper@5bd8e1c Fix MapLike Codec missing key 'selector' (#8634)
PaperMC/Paper@7d18c6b Don't show particles when splash events are canceled (#8637)
PaperMC/Paper@ecfb76a Fix empty effect clouds from lingering potions (#8641)
PaperMC/Paper@1143b63 Add Position (#7639)
PaperMC/Paper@0bdbcd9 [ci skip] Remove non-functioning patch
PaperMC/Paper@d8cf30d Deprecate isPreview method in decorate events (#8645)
PaperMC/Paper@a5ecfd6 [ci skip] Correct chat preview removal version in javadoc (#8646)
PaperMC/Paper@eeeb8d5 Add the non-flammable wood item tag (#8648)
PaperMC/Paper@d2cb347 Fix items equipped on AbstractHorse losing NBT (#8647)
2022-12-12 00:07:02 -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 10e7c382e3e25ede3452b02af0e4d538e9403061..d45cc25d37906ba0c2e5d80936aaae1d7f9f4159 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -257,6 +257,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;
@@ -357,8 +358,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);
@@ -1998,7 +1999,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 5af2254b6dd380ad0822b47292940e08092f0eeb..8f27e6b495b82361d331c514c78088d358e4f5b4 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
@@ -347,7 +347,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
}