From 391ac23c9a6165b23ccc44abf29e6a8fb7b1b6e0 Mon Sep 17 00:00:00 2001 From: Feildmaster Date: Thu, 9 Feb 2012 21:13:35 -0600 Subject: [PATCH] [Bleeding] Fire EntityDamageByEntityEvent's for EnderDragon being hit by Projectiles. --- src/main/java/net/minecraft/server/EntityArrow.java | 4 ++-- src/main/java/net/minecraft/server/EntityEgg.java | 3 +-- src/main/java/net/minecraft/server/EntityFireball.java | 3 +-- src/main/java/net/minecraft/server/EntityFishingHook.java | 2 +- src/main/java/net/minecraft/server/EntitySmallFireball.java | 3 ++- src/main/java/net/minecraft/server/EntitySnowball.java | 2 +- 6 files changed, 8 insertions(+), 9 deletions(-) diff --git a/src/main/java/net/minecraft/server/EntityArrow.java b/src/main/java/net/minecraft/server/EntityArrow.java index 6124c651e9..e968d59253 100644 --- a/src/main/java/net/minecraft/server/EntityArrow.java +++ b/src/main/java/net/minecraft/server/EntityArrow.java @@ -201,8 +201,7 @@ public class EntityArrow extends Entity { // CraftBukkit start boolean stick; - if (entity instanceof EntityLiving) { - + if (entity instanceof EntityLiving || entity instanceof EntityComplexPart) { org.bukkit.entity.Entity damagee = movingobjectposition.entity.getBukkitEntity(); Projectile projectile = (Projectile) this.getBukkitEntity(); @@ -218,6 +217,7 @@ public class EntityArrow extends Entity { } else { stick = movingobjectposition.entity.damageEntity(damagesource, l); } + if (stick) { // CraftBukkit end if (movingobjectposition.entity instanceof EntityLiving) { diff --git a/src/main/java/net/minecraft/server/EntityEgg.java b/src/main/java/net/minecraft/server/EntityEgg.java index 71fe425d55..f3145561f9 100644 --- a/src/main/java/net/minecraft/server/EntityEgg.java +++ b/src/main/java/net/minecraft/server/EntityEgg.java @@ -8,7 +8,6 @@ import org.bukkit.entity.Projectile; import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason; import org.bukkit.event.entity.EntityDamageByEntityEvent; import org.bukkit.event.entity.EntityDamageEvent; -import org.bukkit.event.entity.ProjectileHitEvent; import org.bukkit.event.player.PlayerEggThrowEvent; public class EntityEgg extends EntityProjectile { @@ -29,7 +28,7 @@ public class EntityEgg extends EntityProjectile { // CraftBukkit start if (movingobjectposition.entity != null) { boolean stick; - if (movingobjectposition.entity instanceof EntityLiving) { + if (movingobjectposition.entity instanceof EntityLiving || movingobjectposition.entity instanceof EntityComplexPart) { org.bukkit.entity.Entity damagee = movingobjectposition.entity.getBukkitEntity(); Projectile projectile = (Projectile) this.getBukkitEntity(); diff --git a/src/main/java/net/minecraft/server/EntityFireball.java b/src/main/java/net/minecraft/server/EntityFireball.java index e507fb7b7e..4925dafc23 100644 --- a/src/main/java/net/minecraft/server/EntityFireball.java +++ b/src/main/java/net/minecraft/server/EntityFireball.java @@ -5,7 +5,6 @@ import java.util.List; // CraftBukkit start import org.bukkit.Bukkit; import org.bukkit.craftbukkit.entity.CraftEntity; -import org.bukkit.craftbukkit.entity.CraftLivingEntity; import org.bukkit.entity.Explosive; import org.bukkit.entity.Projectile; import org.bukkit.event.entity.EntityDamageByEntityEvent; @@ -189,7 +188,7 @@ public class EntityFireball extends Entity { // CraftBukkit start if (movingobjectposition.entity != null) { boolean stick; - if (movingobjectposition.entity instanceof EntityLiving) { + if (movingobjectposition.entity instanceof EntityLiving || movingobjectposition.entity instanceof EntityComplexPart) { org.bukkit.entity.Entity damagee = movingobjectposition.entity.getBukkitEntity(); Projectile projectile = (Projectile) this.getBukkitEntity(); diff --git a/src/main/java/net/minecraft/server/EntityFishingHook.java b/src/main/java/net/minecraft/server/EntityFishingHook.java index 653c751eea..e8602b8128 100644 --- a/src/main/java/net/minecraft/server/EntityFishingHook.java +++ b/src/main/java/net/minecraft/server/EntityFishingHook.java @@ -192,7 +192,7 @@ public class EntityFishingHook extends Entity { if (movingobjectposition.entity != null) { // CraftBukkit start boolean stick; - if (movingobjectposition.entity instanceof EntityLiving) { + if (movingobjectposition.entity instanceof EntityLiving || movingobjectposition.entity instanceof EntityComplexPart) { org.bukkit.entity.Entity damagee = movingobjectposition.entity.getBukkitEntity(); Projectile projectile = (Projectile) this.getBukkitEntity(); diff --git a/src/main/java/net/minecraft/server/EntitySmallFireball.java b/src/main/java/net/minecraft/server/EntitySmallFireball.java index f36af592ed..e33055dccb 100644 --- a/src/main/java/net/minecraft/server/EntitySmallFireball.java +++ b/src/main/java/net/minecraft/server/EntitySmallFireball.java @@ -36,8 +36,8 @@ public class EntitySmallFireball extends EntityFireball { boolean stick; org.bukkit.entity.Entity damagee = movingEntity.getBukkitEntity(); Projectile projectile = (Projectile) this.getBukkitEntity(); - if (movingEntity instanceof EntityLiving) { + if (movingEntity instanceof EntityLiving || movingEntity instanceof EntityComplexPart) { EntityDamageByEntityEvent event = new EntityDamageByEntityEvent(projectile, damagee, EntityDamageEvent.DamageCause.PROJECTILE, 5); pluginManager.callEvent(event); @@ -50,6 +50,7 @@ public class EntitySmallFireball extends EntityFireball { } else { stick = movingEntity.damageEntity(DamageSource.fireball(this, this.shooter), 5); } + if (stick) { // if the fireball 'sticks', ignite the target EntityCombustByEntityEvent combustEvent = new EntityCombustByEntityEvent(projectile, damagee, 5); diff --git a/src/main/java/net/minecraft/server/EntitySnowball.java b/src/main/java/net/minecraft/server/EntitySnowball.java index 5090077bb5..f935fbf0b5 100644 --- a/src/main/java/net/minecraft/server/EntitySnowball.java +++ b/src/main/java/net/minecraft/server/EntitySnowball.java @@ -34,7 +34,7 @@ public class EntitySnowball extends EntityProjectile { boolean stick = false; if (movingEntity != null) { - if (movingEntity instanceof EntityLiving) { + if (movingEntity instanceof EntityLiving || movingEntity instanceof EntityComplexPart) { org.bukkit.entity.Entity damagee = movingEntity.getBukkitEntity(); Projectile projectile = (Projectile) this.getBukkitEntity();