geforkt von Mirrors/Paper
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.
Dieser Commit ist enthalten in:
Ursprung
31ba50a539
Commit
9d830d36ce
@ -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;
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren