diff options
author | Travis Watkins <amaranth@ubuntu.com> | 2014-05-26 02:17:53 -0500 |
---|---|---|
committer | Travis Watkins <amaranth@ubuntu.com> | 2014-05-26 18:42:47 -0500 |
commit | e080bafa58c52dc5debf1e6da5ba1c4b5f017795 (patch) | |
tree | 76fdcd6a850bf8751b8bdb87c486e6c059118419 /src/main/java/net/minecraft/server/EntityMagmaCube.java | |
parent | 4ab4fa5bb1d846560d77a34b4b47dcb187f84e5f (diff) | |
download | craftbukkit-e080bafa58c52dc5debf1e6da5ba1c4b5f017795.tar craftbukkit-e080bafa58c52dc5debf1e6da5ba1c4b5f017795.tar.gz craftbukkit-e080bafa58c52dc5debf1e6da5ba1c4b5f017795.tar.lz craftbukkit-e080bafa58c52dc5debf1e6da5ba1c4b5f017795.tar.xz craftbukkit-e080bafa58c52dc5debf1e6da5ba1c4b5f017795.zip |
Rework mob item dropping on death. Fixes BUKKIT-5625
After the changes in d611cff2 we started including a mob's equipment when
calling EntityDeathEvent so plugins can access this data. However, the
changes to enable this triggered a bug that makes skeletons and pig zombies
no longer drop equipment because they handle this differently than the rest.
On top of this we don't handle dropping equipment for mobs that cannot
pick up items in vanilla even though vanilla does drop equipment for them
if you summon them with it. We also do not include a horse's inventory
in the event so they drop their saddle, armor, chest, and chest contents
with no way for a plugin to control this.
To solve this issues we revert mob item dropping back to vanilla logic
and instead just capture all their drops in the method they all call to
spawn them into the world. We also move horse inventory dropping so it
happens at a time when we're capturing these drops. With these changes
all items mobs drop on death should now be included in the event and
we have less diff to worry about for future updates.
Diffstat (limited to 'src/main/java/net/minecraft/server/EntityMagmaCube.java')
-rw-r--r-- | src/main/java/net/minecraft/server/EntityMagmaCube.java | 98 |
1 files changed, 0 insertions, 98 deletions
diff --git a/src/main/java/net/minecraft/server/EntityMagmaCube.java b/src/main/java/net/minecraft/server/EntityMagmaCube.java deleted file mode 100644 index fd50f11b..00000000 --- a/src/main/java/net/minecraft/server/EntityMagmaCube.java +++ /dev/null @@ -1,98 +0,0 @@ -package net.minecraft.server; - -public class EntityMagmaCube extends EntitySlime { - - public EntityMagmaCube(World world) { - super(world); - this.fireProof = true; - } - - protected void aC() { - super.aC(); - this.getAttributeInstance(GenericAttributes.d).setValue(0.20000000298023224D); - } - - public boolean canSpawn() { - return this.world.difficulty != EnumDifficulty.PEACEFUL && this.world.b(this.boundingBox) && this.world.getCubes(this, this.boundingBox).isEmpty() && !this.world.containsLiquid(this.boundingBox); - } - - public int aU() { - return this.getSize() * 3; - } - - public float d(float f) { - return 1.0F; - } - - protected String bP() { - return "flame"; - } - - protected EntitySlime bQ() { - return new EntityMagmaCube(this.world); - } - - protected Item getLoot() { - return Items.MAGMA_CREAM; - } - - protected void dropDeathLoot(boolean flag, int i) { - // CraftBukkit start - Whole method - java.util.List<org.bukkit.inventory.ItemStack> loot = new java.util.ArrayList<org.bukkit.inventory.ItemStack>(); - Item item = this.getLoot(); - - if (item != null && this.getSize() > 1) { - int j = this.random.nextInt(4) - 2; - - if (i > 0) { - j += this.random.nextInt(i + 1); - } - - if (j > 0) { - loot.add(new org.bukkit.inventory.ItemStack(org.bukkit.craftbukkit.util.CraftMagicNumbers.getMaterial(item), j)); - } - } - - org.bukkit.craftbukkit.event.CraftEventFactory.callEntityDeathEvent(this, loot); - // CraftBukkit end - } - - public boolean isBurning() { - return false; - } - - protected int bR() { - return super.bR() * 4; - } - - protected void bS() { - this.h *= 0.9F; - } - - protected void bi() { - this.motY = (double) (0.42F + (float) this.getSize() * 0.1F); - this.al = true; - } - - protected void b(float f) {} - - protected boolean bT() { - return true; - } - - protected int bU() { - return super.bU() + 2; - } - - protected String bV() { - return this.getSize() > 1 ? "mob.magmacube.big" : "mob.magmacube.small"; - } - - public boolean O() { - return false; - } - - protected boolean bW() { - return true; - } -} |