summaryrefslogtreecommitdiffstats
path: root/src/Items/ItemHandler.cpp
diff options
context:
space:
mode:
authorHowaner <franzi.moos@googlemail.com>2014-07-26 13:23:11 +0200
committerHowaner <franzi.moos@googlemail.com>2014-07-26 13:23:11 +0200
commitba36e79bc5fe44ac8752fa7cef3b06fbe8a01647 (patch)
tree6594840bd065c3342e947e6039df67ab07af9610 /src/Items/ItemHandler.cpp
parentFix item durability. (diff)
parentGit: Ignore AllFiles.lst (generated by cmake) (diff)
downloadcuberite-ba36e79bc5fe44ac8752fa7cef3b06fbe8a01647.tar
cuberite-ba36e79bc5fe44ac8752fa7cef3b06fbe8a01647.tar.gz
cuberite-ba36e79bc5fe44ac8752fa7cef3b06fbe8a01647.tar.bz2
cuberite-ba36e79bc5fe44ac8752fa7cef3b06fbe8a01647.tar.lz
cuberite-ba36e79bc5fe44ac8752fa7cef3b06fbe8a01647.tar.xz
cuberite-ba36e79bc5fe44ac8752fa7cef3b06fbe8a01647.tar.zst
cuberite-ba36e79bc5fe44ac8752fa7cef3b06fbe8a01647.zip
Diffstat (limited to '')
-rw-r--r--src/Items/ItemHandler.cpp56
1 files changed, 47 insertions, 9 deletions
diff --git a/src/Items/ItemHandler.cpp b/src/Items/ItemHandler.cpp
index f0a91214d..e256fa232 100644
--- a/src/Items/ItemHandler.cpp
+++ b/src/Items/ItemHandler.cpp
@@ -328,12 +328,9 @@ void cItemHandler::OnBlockDestroyed(cWorld * a_World, cPlayer * a_Player, const
if (a_Player->IsGameModeSurvival())
{
- if (!BlockRequiresSpecialTool(Block) || CanHarvestBlock(Block))
- {
- cChunkInterface ChunkInterface(a_World->GetChunkMap());
- cBlockInServerPluginInterface PluginInterface(*a_World);
- Handler->DropBlock(ChunkInterface, *a_World, PluginInterface, a_Player, a_BlockX, a_BlockY, a_BlockZ);
- }
+ cChunkInterface ChunkInterface(a_World->GetChunkMap());
+ cBlockInServerPluginInterface PluginInterface(*a_World);
+ Handler->DropBlock(ChunkInterface, *a_World, PluginInterface, a_Player, a_BlockX, a_BlockY, a_BlockZ, CanHarvestBlock(Block), a_Player->GetEquippedItem().m_Enchantments.GetLevel(cEnchantments::enchSilkTouch) > 0);
}
if (!cBlockInfo::IsOneHitDig(Block))
@@ -542,9 +539,50 @@ bool cItemHandler::CanRepairWithRawMaterial(short a_ItemType)
bool cItemHandler::CanHarvestBlock(BLOCKTYPE a_BlockType)
{
- UNUSED(a_BlockType);
-
- return false;
+ switch (a_BlockType)
+ {
+ case E_BLOCK_ANVIL:
+ case E_BLOCK_ENCHANTMENT_TABLE:
+ case E_BLOCK_FURNACE:
+ case E_BLOCK_LIT_FURNACE:
+ case E_BLOCK_COAL_ORE:
+ case E_BLOCK_STONE:
+ case E_BLOCK_COBBLESTONE:
+ case E_BLOCK_END_STONE:
+ case E_BLOCK_MOSSY_COBBLESTONE:
+ case E_BLOCK_SANDSTONE_STAIRS:
+ case E_BLOCK_SANDSTONE:
+ case E_BLOCK_STONE_BRICKS:
+ case E_BLOCK_NETHER_BRICK:
+ case E_BLOCK_NETHERRACK:
+ case E_BLOCK_STONE_SLAB:
+ case E_BLOCK_DOUBLE_STONE_SLAB:
+ case E_BLOCK_STONE_PRESSURE_PLATE:
+ case E_BLOCK_BRICK:
+ case E_BLOCK_COBBLESTONE_STAIRS:
+ case E_BLOCK_COBBLESTONE_WALL:
+ case E_BLOCK_STONE_BRICK_STAIRS:
+ case E_BLOCK_NETHER_BRICK_STAIRS:
+ case E_BLOCK_CAULDRON:
+ case E_BLOCK_OBSIDIAN:
+ case E_BLOCK_DIAMOND_BLOCK:
+ case E_BLOCK_DIAMOND_ORE:
+ case E_BLOCK_GOLD_BLOCK:
+ case E_BLOCK_GOLD_ORE:
+ case E_BLOCK_REDSTONE_ORE:
+ case E_BLOCK_REDSTONE_ORE_GLOWING:
+ case E_BLOCK_EMERALD_ORE:
+ case E_BLOCK_IRON_BLOCK:
+ case E_BLOCK_IRON_ORE:
+ case E_BLOCK_LAPIS_ORE:
+ case E_BLOCK_LAPIS_BLOCK:
+ case E_BLOCK_SNOW:
+ case E_BLOCK_VINES:
+ {
+ return false;
+ }
+ default: return true;
+ }
}