mirror of
https://github.com/PurpurMC/Purpur.git
synced 2025-02-17 13:00:04 +08:00
Upstream has released updates that appear to apply and compile correctly Paper Changes: PaperMC/Paper@e16fefb [ci skip] add 'accepted' to Done project category (#9429) PaperMC/Paper@171ba7c Move Log4j plugins to own source set (#9428) PaperMC/Paper@4356758 Call missing BlockDispenseEvents (#8518) PaperMC/Paper@c0936a7 Updated Upstream (Bukkit/CraftBukkit/Spigot) (#9440) PaperMC/Paper@12c9700 Fix ThrownEggHatchEvent#setHatching (#9448)
92 lines
4.7 KiB
Diff
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 0d07e666f4da002a353d03844d62a0e3aac44d9d..92745269118d8a0cb91cbbebdd7700f7737d2b9a 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);
|
|
|
|
@@ -2054,7 +2055,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 296cc895fbd090b4d43807f4ca393f6dd853e0ce..8400f02a37bdef4a9f92879a6b186ebe1f2f145e 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
|
|
@@ -384,7 +384,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 3f7d21a5be726d301e1bcaa11f1788b51c23a7cd..db95323da1aef267aa4fbe56aaff63cb8684e15b 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 7e81ed767bab14eeba1492a05c7ce43cfc2abd5b..c4e94cea3d97d4da342123e10e62ac61a74957f1 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
|
|
}
|