Paper/CraftBukkit-Patches/0094-Cancellable-WitherSkull-potion-effect.patch
Zach Brown c7f1eed0bf Update from upstream SpigotMC
3beb7729816
a77ed5758a7
52c130fc6d9
2014-12-20 19:09:49 -06:00

41 lines
2 KiB
Diff

From 65b65152ae90ec54f37b9c5c22e00299cd13582b Mon Sep 17 00:00:00 2001
From: drXor <mcyoungsota@gmail.com>
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 a4df9a1..b809e1b 100644
--- a/src/main/java/net/minecraft/server/EntityWitherSkull.java
+++ b/src/main/java/net/minecraft/server/EntityWitherSkull.java
@@ -35,8 +35,11 @@ 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)) {
+ didDamage = movingobjectposition.entity.damageEntity(DamageSource.mobAttack(this.shooter), 8.0F);
+ if (didDamage) {
if (!movingobjectposition.entity.isAlive()) {
this.shooter.heal(5.0F, org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason.WITHER); // CraftBukkit
} else {
@@ -44,10 +47,11 @@ public class EntityWitherSkull extends EntityFireball {
}
}
} 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.getDifficulty() == EnumDifficulty.NORMAL) {
--
2.1.0