diff options
author | EvilSeph <evilseph@gmail.com> | 2011-09-20 20:40:22 -0400 |
---|---|---|
committer | EvilSeph <evilseph@gmail.com> | 2011-09-20 23:44:44 -0400 |
commit | 3f04f04be64f1724b1952e3b874697a104ec9094 (patch) | |
tree | 21259caa09e030dac37cb302de6f58ae76df426c /src/main/java/net/minecraft/server/EntityCow.java | |
parent | 0a52c7f3346833fd568e020d3f1b918b792b09f4 (diff) | |
download | craftbukkit-3f04f04be64f1724b1952e3b874697a104ec9094.tar craftbukkit-3f04f04be64f1724b1952e3b874697a104ec9094.tar.gz craftbukkit-3f04f04be64f1724b1952e3b874697a104ec9094.tar.lz craftbukkit-3f04f04be64f1724b1952e3b874697a104ec9094.tar.xz craftbukkit-3f04f04be64f1724b1952e3b874697a104ec9094.zip |
Added/updated EntityDeathEvents to reflect changes to the Vanilla spec.
Diffstat (limited to 'src/main/java/net/minecraft/server/EntityCow.java')
-rw-r--r-- | src/main/java/net/minecraft/server/EntityCow.java | 32 |
1 files changed, 21 insertions, 11 deletions
diff --git a/src/main/java/net/minecraft/server/EntityCow.java b/src/main/java/net/minecraft/server/EntityCow.java index 772c8fb1..84cc8e59 100644 --- a/src/main/java/net/minecraft/server/EntityCow.java +++ b/src/main/java/net/minecraft/server/EntityCow.java @@ -1,9 +1,13 @@ package net.minecraft.server; // CraftBukkit start +import java.util.List; + import org.bukkit.Location; +import org.bukkit.craftbukkit.entity.CraftEntity; import org.bukkit.craftbukkit.event.CraftEventFactory; import org.bukkit.craftbukkit.inventory.CraftItemStack; +import org.bukkit.event.entity.EntityDeathEvent; import org.bukkit.event.player.PlayerBucketFillEvent; // CraftBukkit end @@ -44,23 +48,29 @@ public class EntityCow extends EntityAnimal { } protected void a(boolean flag) { - int i = this.random.nextInt(3); + // CraftBukkit start - whole method + List<org.bukkit.inventory.ItemStack> loot = new java.util.ArrayList<org.bukkit.inventory.ItemStack>(); + int count = this.random.nextInt(3); + + if (count > 0) { + loot.add(new org.bukkit.inventory.ItemStack(Item.LEATHER.id, count)); + } - int j; + count = this.random.nextInt(3) + 1; - for (j = 0; j < i; ++j) { - this.b(Item.LEATHER.id, 1); + if (count > 0) { + loot.add(new org.bukkit.inventory.ItemStack(this.fireTicks > 0 ? Item.COOKED_BEEF.id : Item.RAW_BEEF.id, count)); } - i = this.random.nextInt(3) + 1; + CraftEntity entity = (CraftEntity) this.getBukkitEntity(); + EntityDeathEvent event = new EntityDeathEvent(entity, loot); + org.bukkit.World bworld = this.world.getWorld(); + this.world.getServer().getPluginManager().callEvent(event); - for (j = 0; j < i; ++j) { - if (this.fireTicks > 0) { - this.b(Item.COOKED_BEEF.id, 1); - } else { - this.b(Item.RAW_BEEF.id, 1); - } + for (org.bukkit.inventory.ItemStack stack: event.getDrops()) { + bworld.dropItemNaturally(entity.getLocation(), stack); } + // CraftBukkit end } public boolean b(EntityHuman entityhuman) { |