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@71c84c8 Updated Upstream (Bukkit/CraftBukkit/Spigot) (#10277) PaperMC/Paper@e3bc4c4 Make debug mode print current configuration phase PaperMC/Paper@d0ebfbb Fix corrupted plugin.yml breaking plugin loading (#10279) PaperMC/Paper@681bbff Fix spawnreason saving
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 781eefa21c958c28c35d2d9559d89da236ce9387..5e5485906f1157e52a7082278adcb7b6e56f3f06 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 {
|
|
protected boolean skipDropExperience;
|
|
// CraftBukkit start
|
|
public int expToDrop;
|
|
+ public float safeFallDistance = 3.0F; // Purpur
|
|
public boolean forceDrops;
|
|
public ArrayList<DefaultDrop> drops = new ArrayList<>(); // Paper - Restore vanilla drops behavior
|
|
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);
|
|
|
|
@@ -2117,7 +2118,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 24fb38499092d8cbee3818bf5c873a55465b1edb..3170f9044f18b8c609433ddbd3ef9ac330644a0f 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
|
|
@@ -386,7 +386,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 2a30499fd6f4a1340f6911f0f7f079bcbe8576a3..c3c0fbe71c9af1125c80698865cb9eaf42d4a1c5 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/monster/Giant.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/monster/Giant.java
|
|
@@ -13,6 +13,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 98df582ca3425f621396ce93cf7a0617ce3fb11f..de7a555a646aa4eb1ed4b75e01e6ef373444ac65 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java
|
|
@@ -1156,4 +1156,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
|
|
}
|