summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEvilSeph <evilseph@gmail.com>2011-12-10 15:44:58 -0500
committerEvilSeph <evilseph@gmail.com>2011-12-10 15:59:07 -0500
commitde1a32bb1630146498373f5fc569435b6e3971af (patch)
tree1fb9e7e29a818994e6cd3906a5c2e67289989c59 /src
parentec59dd917390085e0a6a89622ba62527bc65ab11 (diff)
downloadcraftbukkit-de1a32bb1630146498373f5fc569435b6e3971af.tar
craftbukkit-de1a32bb1630146498373f5fc569435b6e3971af.tar.gz
craftbukkit-de1a32bb1630146498373f5fc569435b6e3971af.tar.lz
craftbukkit-de1a32bb1630146498373f5fc569435b6e3971af.tar.xz
craftbukkit-de1a32bb1630146498373f5fc569435b6e3971af.zip
Fixed spiders not respecting the EntityDeathEvent. This fixes BUKKIT-275.
Diffstat (limited to 'src')
-rw-r--r--src/main/java/net/minecraft/server/EntitySpider.java22
1 files changed, 20 insertions, 2 deletions
diff --git a/src/main/java/net/minecraft/server/EntitySpider.java b/src/main/java/net/minecraft/server/EntitySpider.java
index 206ee185..8a2b9d92 100644
--- a/src/main/java/net/minecraft/server/EntitySpider.java
+++ b/src/main/java/net/minecraft/server/EntitySpider.java
@@ -1,8 +1,11 @@
package net.minecraft.server;
// CraftBukkit start
+import java.util.List;
+
import org.bukkit.craftbukkit.entity.CraftEntity;
import org.bukkit.event.entity.EntityTargetEvent;
+import org.bukkit.craftbukkit.event.CraftEventFactory;
// CraftBukkit end
public class EntitySpider extends EntityMonster {
@@ -113,10 +116,25 @@ public class EntitySpider extends EntityMonster {
}
protected void dropDeathLoot(boolean flag, int i) {
- super.dropDeathLoot(flag, i);
+ // CraftBukkit start - whole method; adapted from super.dropDeathLoot.
+ List<org.bukkit.inventory.ItemStack> loot = new java.util.ArrayList<org.bukkit.inventory.ItemStack>();
+
+ int k = this.random.nextInt(3);
+
+ if (i > 0) {
+ k += this.random.nextInt(i + 1);
+ }
+
+ if (k > 0) {
+ loot.add(new org.bukkit.inventory.ItemStack(Item.STRING.id, k));
+ }
+
if (flag && (this.random.nextInt(3) == 0 || this.random.nextInt(1 + i) > 0)) {
- this.b(Item.SPIDER_EYE.id, 1);
+ loot.add(new org.bukkit.inventory.ItemStack(Item.SPIDER_EYE.id, 1));
}
+
+ CraftEventFactory.callEntityDeathEvent(this, loot); // raise event even for those times when the entity does not drop loot
+ // CraftBukkit end
}
public boolean r() {