From d732457354f667e11feee0e64b00593739a2f69e Mon Sep 17 00:00:00 2001 From: Gunther De Wachter Date: Thu, 17 Mar 2011 18:24:36 +0100 Subject: [PATCH] Implement DamageType.VOID --- .../java/net/minecraft/server/EntityLiving.java | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java index b79d6b911d..94882460ba 100644 --- a/src/main/java/net/minecraft/server/EntityLiving.java +++ b/src/main/java/net/minecraft/server/EntityLiving.java @@ -10,6 +10,7 @@ import org.bukkit.craftbukkit.CraftWorld; import org.bukkit.craftbukkit.entity.CraftEntity; import org.bukkit.craftbukkit.TrigMath; import org.bukkit.event.Event.Type; +import org.bukkit.event.entity.EntityDamageByBlockEvent; import org.bukkit.event.entity.EntityDamageEvent; import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import org.bukkit.event.entity.EntityDeathEvent; @@ -796,7 +797,21 @@ public abstract class EntityLiving extends Entity { } protected void M() { - this.a((Entity) null, 4); + // CraftBukkit start + CraftServer server = ((WorldServer) this.world).getServer(); + DamageCause damageType = EntityDamageEvent.DamageCause.VOID; + org.bukkit.block.Block damager = null; + org.bukkit.entity.Entity damagee = this.getBukkitEntity(); + int damageDone = 4; + EntityDamageByBlockEvent event = new EntityDamageByBlockEvent(damager, damagee, damageType, damageDone); + server.getPluginManager().callEvent(event); + + if (event.isCancelled()) { + return; + } + damageDone = event.getDamage(); + this.a((Entity) null, damageDone); + // CraftBukkit end } public Vec3D N() {