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
This commit is contained in:
@@ -26,10 +26,16 @@ public class EntitySlime extends EntityLiving implements IMonster {
|
||||
|
||||
// CraftBukkit - protected -> public
|
||||
public void setSize(int i) {
|
||||
boolean updateMaxHealth = this.getMaxHealth() == this.maxHealth; // CraftBukkit
|
||||
this.datawatcher.watch(16, new Byte((byte) i));
|
||||
this.a(0.6F * (float) i, 0.6F * (float) i);
|
||||
this.setPosition(this.locX, this.locY, this.locZ);
|
||||
this.setHealth(this.getMaxHealth());
|
||||
// CraftBukkit start
|
||||
if (updateMaxHealth) {
|
||||
this.maxHealth = this.getMaxHealth();
|
||||
}
|
||||
this.setHealth(this.maxHealth);
|
||||
// CraftBukkit end
|
||||
this.bd = i;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user