From 0ba2d285f04238572f51dee3fd33dc6d08b7f8f0 Mon Sep 17 00:00:00 2001 From: aPunch Date: Mon, 5 Mar 2012 16:32:09 -0600 Subject: [PATCH] [Bleeding] Made Iron Golems and Ocelots throw EntityDeathEvent. This fixes BUKKIT-1010. --- .../java/net/minecraft/server/EntityIronGolem.java | 11 +++++++++-- src/main/java/net/minecraft/server/EntityOcelot.java | 4 +++- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/main/java/net/minecraft/server/EntityIronGolem.java b/src/main/java/net/minecraft/server/EntityIronGolem.java index bd1bb2ab85..e7da57c61f 100644 --- a/src/main/java/net/minecraft/server/EntityIronGolem.java +++ b/src/main/java/net/minecraft/server/EntityIronGolem.java @@ -1,5 +1,7 @@ package net.minecraft.server; +import org.bukkit.craftbukkit.inventory.CraftItemStack; // CraftBukkit + public class EntityIronGolem extends EntityGolem { private int b = 0; @@ -133,19 +135,24 @@ public class EntityIronGolem extends EntityGolem { } protected void dropDeathLoot(boolean flag, int i) { + // CraftBukkit start + java.util.List loot = new java.util.ArrayList(); int j = this.random.nextInt(3); int k; for (k = 0; k < j; ++k) { - this.b(Block.RED_ROSE.id, 1); + loot.add(new CraftItemStack(Block.RED_ROSE.id, 1)); } k = 3 + this.random.nextInt(3); for (int l = 0; l < k; ++l) { - this.b(Item.IRON_INGOT.id, 1); + loot.add(new CraftItemStack(Item.IRON_INGOT.id, 1)); } + + org.bukkit.craftbukkit.event.CraftEventFactory.callEntityDeathEvent(this, loot); + // CraftBukkit end } public int m_() { diff --git a/src/main/java/net/minecraft/server/EntityOcelot.java b/src/main/java/net/minecraft/server/EntityOcelot.java index cb71cfcbc6..0dce6fa010 100644 --- a/src/main/java/net/minecraft/server/EntityOcelot.java +++ b/src/main/java/net/minecraft/server/EntityOcelot.java @@ -100,7 +100,9 @@ public class EntityOcelot extends EntityTameableAnimal { return super.damageEntity(damagesource, i); } - protected void dropDeathLoot(boolean flag, int i) {} + protected void dropDeathLoot(boolean flag, int i) { + super.dropDeathLoot(flag, i); // CraftBukkit - Calls EntityDeathEvent + } public boolean b(EntityHuman entityhuman) { ItemStack itemstack = entityhuman.inventory.getItemInHand();