diff options
author | Nathan Adams <dinnerbone@dinnerbone.com> | 2011-11-27 04:22:24 +0000 |
---|---|---|
committer | Nathan Adams <dinnerbone@dinnerbone.com> | 2011-11-27 04:22:24 +0000 |
commit | f6dc6745edf97d76fff76740e9794c631799c939 (patch) | |
tree | ddb93a8a21aa9b2df803b0230b4e452600d2eb54 | |
parent | 8d49f500ec98b5f721bd5202edba12d8158175f1 (diff) | |
download | craftbukkit-f6dc6745edf97d76fff76740e9794c631799c939.tar craftbukkit-f6dc6745edf97d76fff76740e9794c631799c939.tar.gz craftbukkit-f6dc6745edf97d76fff76740e9794c631799c939.tar.lz craftbukkit-f6dc6745edf97d76fff76740e9794c631799c939.tar.xz craftbukkit-f6dc6745edf97d76fff76740e9794c631799c939.zip |
Fixed EntityDeathEvent not throwing for Ghasts and Pig Zombies (fixes issue #13)
-rw-r--r-- | src/main/java/net/minecraft/server/EntityGhast.java | 16 | ||||
-rw-r--r-- | src/main/java/net/minecraft/server/EntityPigZombie.java | 14 |
2 files changed, 22 insertions, 8 deletions
diff --git a/src/main/java/net/minecraft/server/EntityGhast.java b/src/main/java/net/minecraft/server/EntityGhast.java index ff10ab4d..9cead916 100644 --- a/src/main/java/net/minecraft/server/EntityGhast.java +++ b/src/main/java/net/minecraft/server/EntityGhast.java @@ -1,7 +1,10 @@ package net.minecraft.server; // CraftBukkit start +import java.util.List; import org.bukkit.craftbukkit.entity.CraftEntity; +import org.bukkit.craftbukkit.event.CraftEventFactory; +import org.bukkit.craftbukkit.inventory.CraftItemStack; import org.bukkit.event.entity.EntityTargetEvent; // CraftBukkit end @@ -196,19 +199,24 @@ public class EntityGhast extends EntityFlying implements IMonster { } protected void a(boolean flag, int i) { + // CraftBukkit start + List<org.bukkit.inventory.ItemStack> loot = new java.util.ArrayList<org.bukkit.inventory.ItemStack>(); int j = this.random.nextInt(2) + this.random.nextInt(1 + i); int k; - for (k = 0; k < j; ++k) { - this.b(Item.GHAST_TEAR.id, 1); + if (j > 0) { + loot.add(new CraftItemStack(Item.GHAST_TEAR.id, j)); } j = this.random.nextInt(3) + this.random.nextInt(1 + i); - for (k = 0; k < j; ++k) { - this.b(Item.SULPHUR.id, 1); + if (j > 0) { + loot.add(new CraftItemStack(Item.SULPHUR.id, j)); } + + CraftEventFactory.callEntityDeathEvent(this, loot); + // CraftBukkit end } protected float o() { diff --git a/src/main/java/net/minecraft/server/EntityPigZombie.java b/src/main/java/net/minecraft/server/EntityPigZombie.java index 84c42746..94936951 100644 --- a/src/main/java/net/minecraft/server/EntityPigZombie.java +++ b/src/main/java/net/minecraft/server/EntityPigZombie.java @@ -4,6 +4,8 @@ import java.util.List; // CraftBukkit start import org.bukkit.craftbukkit.entity.CraftEntity; +import org.bukkit.craftbukkit.event.CraftEventFactory; +import org.bukkit.craftbukkit.inventory.CraftItemStack; import org.bukkit.event.entity.EntityTargetEvent; // CraftBukkit end @@ -110,19 +112,23 @@ public class EntityPigZombie extends EntityZombie { } protected void a(boolean flag, int i) { + // CraftBukkit start + List<org.bukkit.inventory.ItemStack> loot = new java.util.ArrayList<org.bukkit.inventory.ItemStack>(); int j = this.random.nextInt(2 + i); int k; - for (k = 0; k < j; ++k) { - this.b(Item.ROTTEN_FLESH.id, 1); + if (j > 0) { + loot.add(new CraftItemStack(Item.ROTTEN_FLESH.id, j)); } j = this.random.nextInt(2 + i); - for (k = 0; k < j; ++k) { - this.b(Item.GOLD_NUGGET.id, 1); + if (j > 0) { + loot.add(new CraftItemStack(Item.GOLD_NUGGET.id, j)); } + CraftEventFactory.callEntityDeathEvent(this, loot); + // CraftBukkit end } protected int e() { |