From 9d830d36ce1d9e837c6f5651966015645709f6b0 Mon Sep 17 00:00:00 2001 From: Zach Brown <1254957+zachbr@users.noreply.github.com> Date: Mon, 24 Sep 2018 20:48:21 -0400 Subject: [PATCH] Allow zero revive health when it matches maxHealth Apparently a zero max health attribute is perfectly fine in vanilla and our own revive handling code appears to handle the case fine, even when EntityDeathEvent is cancelled. So we should allow it to avoid issues when these mobs are killed. --- Spigot-API-Patches/Improve-death-events.patch | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Spigot-API-Patches/Improve-death-events.patch b/Spigot-API-Patches/Improve-death-events.patch index d75e5fec81..6d97ab5c07 100644 --- a/Spigot-API-Patches/Improve-death-events.patch +++ b/Spigot-API-Patches/Improve-death-events.patch @@ -15,7 +15,7 @@ items and experience which is otherwise only properly possible by using internal code. diff --git a/src/main/java/org/bukkit/event/entity/EntityDeathEvent.java b/src/main/java/org/bukkit/event/entity/EntityDeathEvent.java -index ab9e81fd2..a7b8f869c 100644 +index ab9e81fd..fef134c6 100644 --- a/src/main/java/org/bukkit/event/entity/EntityDeathEvent.java +++ b/src/main/java/org/bukkit/event/entity/EntityDeathEvent.java @@ -0,0 +0,0 @@ import org.bukkit.inventory.ItemStack; @@ -74,7 +74,7 @@ index ab9e81fd2..a7b8f869c 100644 + */ + public void setReviveHealth(double reviveHealth) throws IllegalArgumentException { + double maxHealth = ((LivingEntity) entity).getAttribute(org.bukkit.attribute.Attribute.GENERIC_MAX_HEALTH).getValue(); -+ if ((reviveHealth <= 0) || (reviveHealth > maxHealth)) { ++ if ((maxHealth != 0 && reviveHealth <= 0) || (reviveHealth > maxHealth)) { + throw new IllegalArgumentException("Health must be between 0 (exclusive) and " + maxHealth + " (inclusive), but was " + reviveHealth); + } + this.reviveHealth = reviveHealth;