mirror of
https://github.com/PaperMC/Paper.git
synced 2025-08-18 13:53:49 -07:00
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:
@@ -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) {
|
||||
|
Reference in New Issue
Block a user