aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/server/0071-handle-NaN-health-absorb-values-and-repair-bad-data.patch
diff options
context:
space:
mode:
authorJake Potrebic <[email protected]>2023-02-15 13:27:40 -0800
committerGitHub <[email protected]>2023-02-15 13:27:40 -0800
commitafe633df085f1c78802170bca6d03a6873fc0344 (patch)
tree367330b21a1978676e13790c00d7e2c3f4010a08 /patches/server/0071-handle-NaN-health-absorb-values-and-repair-bad-data.patch
parentf2f9e8cc4dde8b2e754d193d553b99fa824515b1 (diff)
downloadPaper-afe633df085f1c78802170bca6d03a6873fc0344.tar.gz
Paper-afe633df085f1c78802170bca6d03a6873fc0344.zip
convert API/server tests to mockito (#8848)
* convert API tests to mockito * convert server tests to mockito * add co-author
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.patch57
1 files changed, 0 insertions, 57 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
deleted file mode 100644
index e01a3e800a..0000000000
--- a/patches/server/0071-handle-NaN-health-absorb-values-and-repair-bad-data.patch
+++ /dev/null
@@ -1,57 +0,0 @@
-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;
- }
-