Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-11-15 20:40:07 +01:00
f5265d6688
Upstream has released updates that appears to apply and compile correctly. This update has not been tested by PaperMC and as with ANY update, please do your own testing Bukkit Changes: 6ff65c82 SPIGOT-5908: CompassMeta for new lodestone compass data CraftBukkit Changes:3b9cf0f8
Improve code formatting008f039f
SPIGOT-5913: MOTD no longer supports new line characterb8b65eb7
SPIGOT-5908: CompassMeta for new lodestone compass data Spigot Changes: 4d9262cf Rebuild patches d27f7952 SPIGOT-5912: Outdated client message shows outdated server message
58 Zeilen
2.6 KiB
Diff
58 Zeilen
2.6 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Aikar <aikar@aikar.co>
|
|
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/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java
|
|
index f1080e7d10d5105e3f4010489393f6150c7c4a75..374e4a3dcb656d6a84e05bb9260d3198a4243c05 100644
|
|
--- a/src/main/java/net/minecraft/server/EntityLiving.java
|
|
+++ b/src/main/java/net/minecraft/server/EntityLiving.java
|
|
@@ -602,7 +602,13 @@ public abstract class EntityLiving extends Entity {
|
|
|
|
@Override
|
|
public void loadData(NBTTagCompound nbttagcompound) {
|
|
- this.setAbsorptionHearts(nbttagcompound.getFloat("AbsorptionAmount"));
|
|
+ // Paper start - jvm keeps optimizing the setter
|
|
+ float absorptionAmount = nbttagcompound.getFloat("AbsorptionAmount");
|
|
+ if (Float.isNaN(absorptionAmount)) {
|
|
+ absorptionAmount = 0;
|
|
+ }
|
|
+ this.setAbsorptionHearts(absorptionAmount);
|
|
+ // Paper end
|
|
if (nbttagcompound.hasKeyOfType("Attributes", 9) && this.world != null && !this.world.isClientSide) {
|
|
this.getAttributeMap().a(nbttagcompound.getList("Attributes", 10));
|
|
}
|
|
@@ -1051,6 +1057,10 @@ public abstract class EntityLiving extends Entity {
|
|
}
|
|
|
|
public void setHealth(float f) {
|
|
+ // Paper start
|
|
+ if (Float.isNaN(f)) { f = getMaxHealth(); if (this.valid) {
|
|
+ System.err.println("[NAN-HEALTH] " + getName() + " had NaN health set");
|
|
+ } } // Paper end
|
|
// CraftBukkit start - Handle scaled health
|
|
if (this instanceof EntityPlayer) {
|
|
org.bukkit.craftbukkit.entity.CraftPlayer player = ((EntityPlayer) this).getBukkitEntity();
|
|
@@ -2911,7 +2921,7 @@ public abstract class EntityLiving extends Entity {
|
|
}
|
|
|
|
public void setAbsorptionHearts(float f) {
|
|
- if (f < 0.0F) {
|
|
+ if (f < 0.0F || Float.isNaN(f)) { // Paper
|
|
f = 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 9ff3e95210322829342c1d9f9ad94edeae731ca2..1f4ad48dc8299681c7231c126cc59c1a1bca99f3 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
|
@@ -1590,6 +1590,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
|
}
|
|
|
|
public void setRealHealth(double health) {
|
|
+ if (Double.isNaN(health)) {return;} // Paper
|
|
this.health = health;
|
|
}
|
|
|