diff options
author | Jaume Aloy <hircine45@gmail.com> | 2014-08-19 16:08:17 +0200 |
---|---|---|
committer | Jaume Aloy <hircine45@gmail.com> | 2014-08-19 16:08:17 +0200 |
commit | 1897f678f93bb038fdc4caf1fb2995a28ef8f92e (patch) | |
tree | 08feb248f0a51b067fd61192ca10d3272dcd4d90 /src/Blocks/BlockHandler.cpp | |
parent | Added some Enchantments (diff) | |
download | cuberite-1897f678f93bb038fdc4caf1fb2995a28ef8f92e.tar cuberite-1897f678f93bb038fdc4caf1fb2995a28ef8f92e.tar.gz cuberite-1897f678f93bb038fdc4caf1fb2995a28ef8f92e.tar.bz2 cuberite-1897f678f93bb038fdc4caf1fb2995a28ef8f92e.tar.lz cuberite-1897f678f93bb038fdc4caf1fb2995a28ef8f92e.tar.xz cuberite-1897f678f93bb038fdc4caf1fb2995a28ef8f92e.tar.zst cuberite-1897f678f93bb038fdc4caf1fb2995a28ef8f92e.zip |
Diffstat (limited to '')
-rw-r--r-- | src/Blocks/BlockHandler.cpp | 32 |
1 files changed, 28 insertions, 4 deletions
diff --git a/src/Blocks/BlockHandler.cpp b/src/Blocks/BlockHandler.cpp index 52f7dd608..3c85a31e0 100644 --- a/src/Blocks/BlockHandler.cpp +++ b/src/Blocks/BlockHandler.cpp @@ -424,19 +424,43 @@ void cBlockHandler::DropBlock(cChunkInterface & a_ChunkInterface, cWorldInterfac cItems Pickups; NIBBLETYPE Meta = a_ChunkInterface.GetBlockMeta(a_BlockX, a_BlockY, a_BlockZ); - if (a_CanDrop) + // Thanks to daniel0916 + cPlayer * Player = (cPlayer *)a_Digger; + cEnchantments Enchantments = Player->GetInventory().GetEquippedItem().m_Enchantments; + if (Enchantments.GetLevel(cEnchantments::enchSilkTouch) > 0) { - if (!a_DropVerbatim) + BLOCKTYPE Type = a_ChunkInterface.GetBlock(a_BlockX, a_BlockY, a_BlockZ); + if (Type == E_BLOCK_CAKE || Type == E_BLOCK_CARROTS || Type == E_BLOCK_COCOA_POD || Type == E_BLOCK_DOUBLE_STONE_SLAB || + Type == E_BLOCK_DOUBLE_WOODEN_SLAB || Type == E_BLOCK_FIRE || Type == E_BLOCK_FARMLAND || Type == E_BLOCK_MELON_STEM || + Type == E_BLOCK_MOB_SPAWNER || Type == E_BLOCK_NETHER_WART || Type == E_BLOCK_POTATOES || Type == E_BLOCK_PUMPKIN_STEM || + Type == E_BLOCK_SNOW || Type == E_BLOCK_SUGARCANE || Type == E_BLOCK_TALL_GRASS || Type == E_BLOCK_CROPS + ) { + // Silktouch can't be used for this blocks ConvertToPickups(Pickups, Meta); } else { - // TODO: Add a proper overridable function for this Pickups.Add(m_BlockType, 1, Meta); } } - + else + { + if (a_CanDrop) + { + if (!a_DropVerbatim) + { + ConvertToPickups(Pickups, Meta); + } + else + { + // TODO: Add a proper overridable function for this + Pickups.Add(m_BlockType, 1, Meta); + } + } + + } + // Allow plugins to modify the pickups: a_BlockPluginInterface.CallHookBlockToPickups(a_Digger, a_BlockX, a_BlockY, a_BlockZ, m_BlockType, Meta, Pickups); |