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

Paper Changes:
PaperMC/Paper@c1b4899 Fix dupe uuid check on entity add (#6735)
PaperMC/Paper@3f043f7 Async catch modifications to critical entity state
PaperMC/Paper@bc43f40 Update jline and TCA (#6829)
PaperMC/Paper@d9e2817 Update paperweight to 1.1.13 (#6866)
PaperMC/Paper@3e310e0 Remove redundant and unneeded repos, reorder repos (#6867)
PaperMC/Paper@485d15f Update paperweight to 1.1.14 (#6868)
PaperMC/Paper@09d50a9 Added missing mappings (#6810)
PaperMC/Paper@0968cdd Move async catches back to where they were (#6869)
PaperMC/Paper@6f71b7c Deduplicate strings in ObfHelper (#6841)
PaperMC/Paper@ada930b Updated Upstream (Bukkit/CraftBukkit) (#6872)
PaperMC/Paper@06d82e0 Cache palette array (#6767)
PaperMC/Paper@70fe58d Expose the potential player cause of a lightning (#6782)
PaperMC/Paper@c20c9d3 Fix CraftNamespacedKey shenanigans (#6825)
PaperMC/Paper@29bb5a9 Add PlayerDeathEvent#getPlayer for clarity (#6859)
PaperMC/Paper@124d079 Fix issues with mob conversion (#6831)
PaperMC/Paper@22b0238 Add API for checking if a zombie has the option to break doors (#6855)
PaperMC/Paper@5af80b0 Add isCollidable methods to various places (#6870)
PaperMC/Paper@32ba088 Fix setPatternColor on tropical fish bucket meta (#6877)
PaperMC/Paper@87121ce Move `getTrackedPlayers` up from Player to Entity (#6569)
PaperMC/Paper@a923e33 Make despawn distance configs per-category, improve per category spawn limit config (#6717)
PaperMC/Paper@3f17694 Goat ram API (#6336)
PaperMC/Paper@cc2ecbc Add Raw Byte Entity Serialization (#6826)

Airplane Changes:
TECHNOVE/Airplane@e47949b Ty Penple <3
TECHNOVE/Airplane@86fee6b Update upstream
2021-11-11 02:03:29 -05:00

85 lines
4.4 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 fc5921a4fe7098fad977e72cdcdeb7811eab0819..e0e1799c001e885b919aa60ca769392b1632c2e1 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -254,6 +254,7 @@ public abstract class LivingEntity extends Entity {
// CraftBukkit start
public int expToDrop;
public int maxAirTicks = 300;
+ 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;
@@ -352,8 +353,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 (!landedState.isAir()) {
double d1 = Math.min((double) (0.2F + f / 15.0F), 2.5D);
@@ -1904,7 +1905,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 44d5f629da36a88e5245e9a2cff39dd946be4ea1..dbd34f589a146b9b408318c3810321ab6bce57f6 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
@@ -321,7 +321,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 c67f33f2e2e0ff5c2a85782185103325a6bf4535..a8ffdc8810152d77668aad7bad15a00c4d194d4c 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 4cdc80b31ac56b63df80fefec87e4ba8b4dcf455..916d487372efdbf68a383f4ae761cccd75e0a1d8 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
@@ -920,4 +920,16 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
throw new IllegalArgumentException(entityCategory + " is an unrecognized entity category");
}
// Paper end
+
+ // Purpur start
+ @Override
+ public float getSafeFallDistance() {
+ return getHandle().safeFallDistance;
+ }
+
+ @Override
+ public void setSafeFallDistance(float safeFallDistance) {
+ getHandle().safeFallDistance = safeFallDistance;
+ }
+ // Purpur end
}