From 01e6512f0686a7b9d99eabedb1bba6ed32a80723 Mon Sep 17 00:00:00 2001 From: drXor Date: Tue, 25 Feb 2014 15:17:29 -0400 Subject: [PATCH] Allow the potion effect caused by WitherSkulls to be cancelled along with damage cancellation (e.g. via events). --- ...ancellable-WitherSkull-potion-effect.patch | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 CraftBukkit-Patches/0117-Cancellable-WitherSkull-potion-effect.patch diff --git a/CraftBukkit-Patches/0117-Cancellable-WitherSkull-potion-effect.patch b/CraftBukkit-Patches/0117-Cancellable-WitherSkull-potion-effect.patch new file mode 100644 index 000000000..ebaac3ed7 --- /dev/null +++ b/CraftBukkit-Patches/0117-Cancellable-WitherSkull-potion-effect.patch @@ -0,0 +1,36 @@ +From 300acb214df362bccede10b67b02fd974f353ea4 Mon Sep 17 00:00:00 2001 +From: drXor +Date: Tue, 25 Feb 2014 15:15:26 -0400 +Subject: [PATCH] Cancellable WitherSkull potion effect + + +diff --git a/src/main/java/net/minecraft/server/EntityWitherSkull.java b/src/main/java/net/minecraft/server/EntityWitherSkull.java +index 2d428f9..de0f2bb 100644 +--- a/src/main/java/net/minecraft/server/EntityWitherSkull.java ++++ b/src/main/java/net/minecraft/server/EntityWitherSkull.java +@@ -35,15 +35,19 @@ public class EntityWitherSkull extends EntityFireball { + protected void a(MovingObjectPosition movingobjectposition) { + if (!this.world.isStatic) { + if (movingobjectposition.entity != null) { ++ // Spigot start ++ boolean didDamage = false; + if (this.shooter != null) { +- if (movingobjectposition.entity.damageEntity(DamageSource.mobAttack(this.shooter), 8.0F) && !movingobjectposition.entity.isAlive()) { ++ didDamage = movingobjectposition.entity.damageEntity(DamageSource.mobAttack(this.shooter), 8.0F); ++ if (didDamage && !movingobjectposition.entity.isAlive()) { + this.shooter.heal(5.0F, org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason.WITHER); // CraftBukkit + } + } else { +- movingobjectposition.entity.damageEntity(DamageSource.MAGIC, 5.0F); ++ didDamage = movingobjectposition.entity.damageEntity(DamageSource.MAGIC, 5.0F); + } + +- if (movingobjectposition.entity instanceof EntityLiving) { ++ if (didDamage && movingobjectposition.entity instanceof EntityLiving) { ++ // Spigot end + byte b0 = 0; + + if (this.world.difficulty == EnumDifficulty.NORMAL) { +-- +1.8.3.2 +