diff options
author | brickmonster <[email protected]> | 2023-02-13 17:52:27 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2023-02-13 18:52:27 +0100 |
commit | f2f9e8cc4dde8b2e754d193d553b99fa824515b1 (patch) | |
tree | a84a54ca38107fcc73211d0a329e98a2bf5ee2fa /patches/server/0071-handle-NaN-health-absorb-values-and-repair-bad-data.patch | |
parent | 8d1acf68edca768053426d1f2ba2c66049dec3a0 (diff) | |
download | Paper-f2f9e8cc4dde8b2e754d193d553b99fa824515b1.tar.gz Paper-f2f9e8cc4dde8b2e754d193d553b99fa824515b1.zip |
Remove patch that was made obsolete by vanilla (#8847)
Diffstat (limited to 'patches/server/0071-handle-NaN-health-absorb-values-and-repair-bad-data.patch')
-rw-r--r-- | patches/server/0071-handle-NaN-health-absorb-values-and-repair-bad-data.patch | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/patches/server/0071-handle-NaN-health-absorb-values-and-repair-bad-data.patch b/patches/server/0071-handle-NaN-health-absorb-values-and-repair-bad-data.patch new file mode 100644 index 0000000000..e01a3e800a --- /dev/null +++ b/patches/server/0071-handle-NaN-health-absorb-values-and-repair-bad-data.patch @@ -0,0 +1,57 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Aikar <[email protected]> +Date: Sun, 27 Sep 2015 01:18:02 -0400 +Subject: [PATCH] handle NaN health/absorb values and repair bad data + + +diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java +index 29495ff2d2c31f6b6ef6e2817662d143e538f926..b2871726eb4dd7f16d161097cbf0f287839e10ba 100644 +--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java ++++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java +@@ -783,7 +783,13 @@ public abstract class LivingEntity extends Entity { + + @Override + public void readAdditionalSaveData(CompoundTag nbt) { +- this.setAbsorptionAmount(nbt.getFloat("AbsorptionAmount")); ++ // Paper start - jvm keeps optimizing the setter ++ float absorptionAmount = nbt.getFloat("AbsorptionAmount"); ++ if (Float.isNaN(absorptionAmount)) { ++ absorptionAmount = 0; ++ } ++ this.setAbsorptionAmount(absorptionAmount); ++ // Paper end + if (nbt.contains("Attributes", 9) && this.level != null && !this.level.isClientSide) { + this.getAttributes().load(nbt.getList("Attributes", 10)); + } +@@ -1270,6 +1276,10 @@ public abstract class LivingEntity extends Entity { + } + + public void setHealth(float health) { ++ // Paper start ++ if (Float.isNaN(health)) { health = getMaxHealth(); if (this.valid) { ++ System.err.println("[NAN-HEALTH] " + getScoreboardName() + " had NaN health set"); ++ } } // Paper end + // CraftBukkit start - Handle scaled health + if (this instanceof ServerPlayer) { + org.bukkit.craftbukkit.entity.CraftPlayer player = ((ServerPlayer) this).getBukkitEntity(); +@@ -3472,7 +3482,7 @@ public abstract class LivingEntity extends Entity { + } + + public void setAbsorptionAmount(float amount) { +- if (amount < 0.0F) { ++ if (amount < 0.0F || Float.isNaN(amount)) { // Paper + amount = 0.0F; + } + +diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +index e4cbd5bee86f7ad26eb78b3c1d279a65b896fb77..2338f20c1af3b93cb6dd1a3c518499e6dd2130c3 100644 +--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java ++++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +@@ -2033,6 +2033,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { + } + + public void setRealHealth(double health) { ++ if (Double.isNaN(health)) {return;} // Paper + this.health = health; + } + |