From 50b75cd65dd241a01d160d1a4e31de4e643be36e Mon Sep 17 00:00:00 2001 From: md_5 Date: Sat, 8 Jul 2017 22:40:54 +1000 Subject: [PATCH] SPIGOT-3407: Set damager for evoker fangs --- nms-patches/EntityEvokerFangs.patch | 12 ++++++++++++ .../bukkit/craftbukkit/event/CraftEventFactory.java | 2 ++ 2 files changed, 14 insertions(+) create mode 100644 nms-patches/EntityEvokerFangs.patch diff --git a/nms-patches/EntityEvokerFangs.patch b/nms-patches/EntityEvokerFangs.patch new file mode 100644 index 0000000000..0e392ed56e --- /dev/null +++ b/nms-patches/EntityEvokerFangs.patch @@ -0,0 +1,12 @@ +--- a/net/minecraft/server/EntityEvokerFangs.java ++++ b/net/minecraft/server/EntityEvokerFangs.java +@@ -108,7 +108,9 @@ + + if (entityliving.isAlive() && !entityliving.be() && entityliving != entityliving1) { + if (entityliving1 == null) { ++ org.bukkit.craftbukkit.event.CraftEventFactory.entityDamage = this; // CraftBukkit + entityliving.damageEntity(DamageSource.MAGIC, 6.0F); ++ org.bukkit.craftbukkit.event.CraftEventFactory.entityDamage = null; // CraftBukkit + } else { + if (entityliving1.r(entityliving)) { + return; diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java index be0f46f925..33020b902d 100644 --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java @@ -520,6 +520,8 @@ public class CraftEventFactory { cause = DamageCause.FALL; } else if (source == DamageSource.DRAGON_BREATH) { cause = DamageCause.DRAGON_BREATH; + } else if (source == DamageSource.MAGIC) { + cause = DamageCause.MAGIC; } else { throw new IllegalStateException(String.format("Unhandled damage of %s by %s from %s", entity, damager.getHandle(), source.translationIndex)); }