[ci skip]
This commit is contained in:
@@ -1,72 +0,0 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Etil <81570777+etil2jz@users.noreply.github.com>
|
||||
Date: Sun, 26 Sep 2021 14:22:43 +0200
|
||||
Subject: [PATCH] (Purpur) 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 0b6331f333e7cbdb76f83cbc2acb027e5716bc07..2c75b42502a120eabbbde6049f508e72eb7faef1 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;
|
||||
@@ -349,8 +350,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 5c104bf219e5e4acb8acfb160bd92f0a0621d864..d2baa54d884d4c6fff49b4524a3bb36bdf10962b 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
|
||||
@@ -284,7 +284,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/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
||||
index fe71123dc07cb13ffad8f13e57aa9bda1cb0abf5..6b82d5201b80df7f69b915ae4c776c2f7ab3bfcb 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
||||
@@ -916,4 +916,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
|
||||
}
|
||||
Reference in New Issue
Block a user