summaryrefslogtreecommitdiffstats
path: root/src/main/java/net/minecraft/server/Entity.java
diff options
context:
space:
mode:
authorfeildmaster <admin@feildmaster.com>2012-12-26 19:07:47 -0600
committerfeildmaster <admin@feildmaster.com>2012-12-27 21:05:40 -0600
commit509e3d2a328273b08e3a203023b117ad120b31dd (patch)
tree5e73db383bf32f0a84c4a0cef13f2917c45d4d5a /src/main/java/net/minecraft/server/Entity.java
parentb908c192bfafe568131a018d8a961b0e7f8e43ee (diff)
downloadcraftbukkit-509e3d2a328273b08e3a203023b117ad120b31dd.tar
craftbukkit-509e3d2a328273b08e3a203023b117ad120b31dd.tar.gz
craftbukkit-509e3d2a328273b08e3a203023b117ad120b31dd.tar.lz
craftbukkit-509e3d2a328273b08e3a203023b117ad120b31dd.tar.xz
craftbukkit-509e3d2a328273b08e3a203023b117ad120b31dd.zip
Update maxhealth for entities that have variable max health. Fixes BUKKIT-3308
Slimes and wolves have health that can change based on certain conditions. So we check if their max health should be updated, and if it has been customized in any way. We also scale the wolf's health for their tail
Diffstat (limited to 'src/main/java/net/minecraft/server/Entity.java')
-rw-r--r--src/main/java/net/minecraft/server/Entity.java10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index 1b1cd912..32804143 100644
--- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java
@@ -1155,6 +1155,16 @@ public abstract class Entity {
this.b(this.yaw, this.pitch);
this.a(nbttagcompound);
+ // CraftBukkit start
+ if (this instanceof EntityLiving) {
+ EntityLiving entity = (EntityLiving) this;
+ // If the entity does not have a max health set yet, update it (it may have changed after loading the entity)
+ if (!nbttagcompound.hasKey("Bukkit.MaxHealth")) {
+ entity.maxHealth = entity.getMaxHealth();
+ }
+ }
+ // CraftBukkit end
+
// CraftBukkit start - exempt Vehicles from notch's sanity check
if (!(this.getBukkitEntity() instanceof Vehicle)) {
if (Math.abs(this.motX) > 10.0D) {