mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-17 16:37:43 +01:00
Upstream has released updates that appear to apply and compile correctly Paper Changes: PaperMC/Paper@512995c Updated Upstream (Bukkit/CraftBukkit/Spigot) (#7359) PaperMC/Paper@0a9602c [ci skip] Fix multiple ItemStack array nullability mistakes (#7055)
85 lines
4.3 KiB
Diff
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 e25bf8d2b00fab28aefc0587af5e05cb45c4e352..ea51a01e8c8da9c8275c74e3f1e7cf8ab458c687 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
|
@@ -250,6 +250,7 @@ public abstract class LivingEntity extends Entity {
|
|
protected Brain<?> brain;
|
|
// 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;
|
|
@@ -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);
|
|
@@ -1924,7 +1925,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 fe4eb55cdfa62c169f2b7ac76d086b41c5b08892..61d39062021ca23aa94d9fcf584f14599fd7411c 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 72bc0a1ad028f7c180487be8f0e990312c12bebe..800192122a596c672bdffbd5ac7c62543d6f45ed 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
|
|
}
|