Files
Purpur/patches/server/0014-LivingEntity-safeFallDistance.patch
Encode42 26e5f080f2 Updated Upstream (Paper)
Upstream has released updates that appear to apply and compile correctly

Paper Changes:
PaperMC/Paper@b4192fd fix NPE from changes in e4358b82171
PaperMC/Paper@5b6445a Revert "fix NPE from changes in e4358b82171"
PaperMC/Paper@323c087 Revert "#686: Fix contains for default section generating real sections"
PaperMC/Paper@c837002 Fix client world difficulty sync issue (#7035)
PaperMC/Paper@a4782f7 [ci skip] fixup indent
PaperMC/Paper@83aee0f [ci skip] Clarify setSize consequences for Slimes (#7036)
PaperMC/Paper@7c8fdc1 Add dropped hunk from mid-tick tasks (#7034)
PaperMC/Paper@fd263ef Fix empty/null chunk section check in LevelChunk#getBlockData, rename… (#7039)
PaperMC/Paper@b8d486c Create workflow to add new PRs to the PR Queue project (#6918)
PaperMC/Paper@a50e273 Include axolotls in affected entities for water splash potions (#7024)
PaperMC/Paper@af95df8 Port Actually unload POI data from Tuinity 1.16 (#7044)
PaperMC/Paper@04897b1 [ci skip] Revert "Create workflow to add new PRs to the PR Queue project (#6918)" (#7046)
PaperMC/Paper@b4a77a8 Updated Upstream (Bukkit/CraftBukkit) (#7045)
PaperMC/Paper@0e25db2 Fix mis-placed processEnchantOrder from 1.18 update (#7052)
PaperMC/Paper@53d026e Fix unused EntitySectionStorage#getEntities(AABB, Consumer) method being broken
PaperMC/Paper@772e880 Fix light propagation in high y sections
PaperMC/Paper@33ea869 Bump Starlight light version
PaperMC/Paper@74fd151 Fix entity equipment on cancellation of EntityDeathEvent (#5740)
PaperMC/Paper@758e2a7 Fix bad ticking checks for blocks
PaperMC/Paper@0e91b6a Return 0 for light values if a dimenion does not have them
PaperMC/Paper@188a8df Fix ChunkSnapshot#isSectionEmpty(int)
PaperMC/Paper@bbc7451 Fix issue with snapshotted biomes in last commit
PaperMC/Paper@b475c6a Backport log4j fix
PaperMC/Paper@4e355c4 Updated Upstream (CraftBukkit)
PaperMC/Paper@dce79f3 Update Log4J (#7069)
2021-12-09 22:46:19 -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 77cde266fcd6e7d0c10fdcb5380bc80811a05016..bdbe89f21408c46a3ab1f6d8a58d93c94e50975f 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -252,6 +252,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;
@@ -350,8 +351,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 c6ee03e25adac9ecebd1e1718588b84f57184ce9..0be0c81f2b0a58eba75eb8559f78d8a58014d0ae 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
@@ -323,7 +323,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 a6f3cac3c6ee6129f61ab43e9afd82cc7b83e058..d1756353b9fc22f6e9b957a708073545ab3c941a 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 c022751e3b45469cc0ad6732e2d6ff08918bafa4..1dcfe129ec3633de67404ab5ab72cdcee31d3d9d 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
}