diff options
author | t00thpick1 <t00thpick1dirko@gmail.com> | 2013-12-12 12:40:42 -0500 |
---|---|---|
committer | Nate Mortensen <nate.richard.mortensen@gmail.com> | 2013-12-13 22:42:39 -0700 |
commit | a565486ee1aa93166b7aaa4c22ca76be15f4f2ab (patch) | |
tree | 24c3b9e4b9f3d909c9cd4f9e5360a680cec3f015 /src/main/java/org/bukkit | |
parent | 1ff8132bdd5bfe6e60d16ee3d54f58c472ab0296 (diff) | |
download | craftbukkit-a565486ee1aa93166b7aaa4c22ca76be15f4f2ab.tar craftbukkit-a565486ee1aa93166b7aaa4c22ca76be15f4f2ab.tar.gz craftbukkit-a565486ee1aa93166b7aaa4c22ca76be15f4f2ab.tar.lz craftbukkit-a565486ee1aa93166b7aaa4c22ca76be15f4f2ab.tar.xz craftbukkit-a565486ee1aa93166b7aaa4c22ca76be15f4f2ab.zip |
[Bleeding] Return correct drops for Cocoa blocks. Fixes BUKKIT-5159
For Cocoa Blocks, Block.getDropType() returns the item form of the Cocoa
block, rather than the Cocoa Bean item. Because of this, Cocoa blocks need
to have explicit handling in order to return the proper drop contents.
Diffstat (limited to 'src/main/java/org/bukkit')
-rw-r--r-- | src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java index 3b5e938d..5fc334a9 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java @@ -6,6 +6,7 @@ import java.util.Collections; import java.util.List; import net.minecraft.server.BiomeBase; +import net.minecraft.server.BlockCocoa; import net.minecraft.server.BlockRedstoneWire; import net.minecraft.server.Blocks; import net.minecraft.server.EnumSkyBlock; @@ -428,6 +429,12 @@ public class CraftBlock implements Block { } drops.add(CraftItemStack.asBukkitCopy(nmsStack)); + // We don't want to drop cocoa blocks, we want to drop cocoa beans. + } else if (Blocks.COCOA == block) { + int dropAmount = (BlockCocoa.c(data) >= 2 ? 3 : 1); + for (int j = 0; j < dropAmount; ++j) { + drops.add(new ItemStack(Material.INK_SACK, 1, (short) 3)); + } } else { drops.add(new ItemStack(org.bukkit.craftbukkit.util.CraftMagicNumbers.getMaterial(item), 1, (short) block.getDropData(data))); } |