diff options
author | Tiger Wang <ziwei.tiger@hotmail.co.uk> | 2014-07-24 22:38:25 +0200 |
---|---|---|
committer | Tiger Wang <ziwei.tiger@hotmail.co.uk> | 2014-07-24 22:38:25 +0200 |
commit | 3a6002de5b13c1cd56d904892e5af6123978225d (patch) | |
tree | 5f8b28e6b4d21de5823b8c7988d41f4af653f1f7 /src/Items | |
parent | Merge pull request #1237 from tonibm19/master (diff) | |
download | cuberite-3a6002de5b13c1cd56d904892e5af6123978225d.tar cuberite-3a6002de5b13c1cd56d904892e5af6123978225d.tar.gz cuberite-3a6002de5b13c1cd56d904892e5af6123978225d.tar.bz2 cuberite-3a6002de5b13c1cd56d904892e5af6123978225d.tar.lz cuberite-3a6002de5b13c1cd56d904892e5af6123978225d.tar.xz cuberite-3a6002de5b13c1cd56d904892e5af6123978225d.tar.zst cuberite-3a6002de5b13c1cd56d904892e5af6123978225d.zip |
Diffstat (limited to '')
-rw-r--r-- | src/Items/ItemHandler.cpp | 47 | ||||
-rw-r--r-- | src/Items/ItemSword.h | 1 |
2 files changed, 43 insertions, 5 deletions
diff --git a/src/Items/ItemHandler.cpp b/src/Items/ItemHandler.cpp index 1671a8145..23dbb4348 100644 --- a/src/Items/ItemHandler.cpp +++ b/src/Items/ItemHandler.cpp @@ -330,7 +330,7 @@ void cItemHandler::OnBlockDestroyed(cWorld * a_World, cPlayer * a_Player, const { 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)); + 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); } a_Player->UseEquippedItem(); @@ -511,9 +511,48 @@ 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: + { + return false; + } + default: return true; + } } diff --git a/src/Items/ItemSword.h b/src/Items/ItemSword.h index 44feb2d83..368b8724e 100644 --- a/src/Items/ItemSword.h +++ b/src/Items/ItemSword.h @@ -16,7 +16,6 @@ public: cItemSwordHandler(int a_ItemType) : cItemHandler(a_ItemType) { - } virtual bool CanHarvestBlock(BLOCKTYPE a_BlockType) override |