From ec1012b5d5effc9ccf00a4bd388aa3ae7e3d99a8 Mon Sep 17 00:00:00 2001 From: Zach Brown 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/0149-Improve-death-events.patch | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Spigot-API-Patches/0149-Improve-death-events.patch b/Spigot-API-Patches/0149-Improve-death-events.patch index bca9a6be3..d86d43608 100644 --- a/Spigot-API-Patches/0149-Improve-death-events.patch +++ b/Spigot-API-Patches/0149-Improve-death-events.patch @@ -1,4 +1,4 @@ -From c3e3a14ed619bbe7b1eb5af0a11c333dd495652b Mon Sep 17 00:00:00 2001 +From aef4c17d56b4333e03d4a071b0f3fd61a7c9bab8 Mon Sep 17 00:00:00 2001 From: Phoenix616 Date: Tue, 21 Aug 2018 01:32:28 +0100 Subject: [PATCH] Improve death events @@ -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 @@ -8,10 +8,19 @@ 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;