1
0

Blocks only drop pickups when using correct tool (#4505)

Co-authored-by: mluchterhand <mluchterhand@max.de>
This commit is contained in:
Max Luchterhand 2020-03-18 16:59:28 +00:00 committed by GitHub
parent 0718c44e77
commit 57da82524b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 1 deletions

2
.gitignore vendored
View File

@ -25,6 +25,7 @@ cloc.xsl
*.sqlite
/EveryNight.cmd
/UploadLuaAPI.cmd
GPUCache
AllFiles.lst
# IDE Stuff
@ -104,6 +105,7 @@ ReleaseProfile/
*.dir/
CPackConfig.cmake
CPackSourceConfig.cmake
cmake-build-debug
# APIDump-generated status files:
Server/cuberite_api.lua

View File

@ -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;