summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMax Luchterhand <52720531+maxluchterhand1@users.noreply.github.com>2020-03-18 17:59:28 +0100
committerGitHub <noreply@github.com>2020-03-18 17:59:28 +0100
commit57da82524bc0b216f232c377e5451bcd187e2ec6 (patch)
tree827af4a948174935fe17e343f174a82ff3e76767 /src
parentSilk touch pickaxe drops grass block (#4485) (diff)
downloadcuberite-57da82524bc0b216f232c377e5451bcd187e2ec6.tar
cuberite-57da82524bc0b216f232c377e5451bcd187e2ec6.tar.gz
cuberite-57da82524bc0b216f232c377e5451bcd187e2ec6.tar.bz2
cuberite-57da82524bc0b216f232c377e5451bcd187e2ec6.tar.lz
cuberite-57da82524bc0b216f232c377e5451bcd187e2ec6.tar.xz
cuberite-57da82524bc0b216f232c377e5451bcd187e2ec6.tar.zst
cuberite-57da82524bc0b216f232c377e5451bcd187e2ec6.zip
Diffstat (limited to 'src')
-rw-r--r--src/Chunk.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/Chunk.cpp b/src/Chunk.cpp
index 75773c8b9..52464f4da 100644
--- a/src/Chunk.cpp
+++ b/src/Chunk.cpp
@@ -974,7 +974,13 @@ cItems cChunk::PickupsFromBlock(Vector3i a_RelPos, const cEntity * a_Digger, con
GetBlockTypeMeta(a_RelPos, blockType, blockMeta);
auto blockHandler = cBlockInfo::GetHandler(blockType);
auto blockEntity = GetBlockEntityRel(a_RelPos);
- auto pickups = blockHandler->ConvertToPickups(blockMeta, blockEntity, a_Digger, a_Tool);
+ cItems pickups (0);
+ auto toolHandler = a_Tool ? a_Tool->GetHandler() : cItemHandler::GetItemHandler(E_ITEM_EMPTY);
+ auto canHarvestBlock = toolHandler->CanHarvestBlock(blockType);
+ if (canHarvestBlock)
+ {
+ pickups = blockHandler->ConvertToPickups(blockMeta, blockEntity, a_Digger, a_Tool);
+ }
auto absPos = RelativeToAbsolute(a_RelPos);
cRoot::Get()->GetPluginManager()->CallHookBlockToPickups(*m_World, absPos, blockType, blockMeta, blockEntity, a_Digger, a_Tool, pickups);
return pickups;