From 125df19477055a8e33b25aaafa05f5c59fd32626 Mon Sep 17 00:00:00 2001 From: Tiger Wang Date: Sun, 28 Mar 2021 14:41:34 +0100 Subject: Do not fake a tool when converting to pickups (#5170) * When the cause of destruction was world-induced (CanBeAt check failed) there is no tool. Pass the nullptr directly to ConvertToPickups and let it handle it. * Fixes #4795 - Remove unused a_Digger parameter to ConvertToPickups. --- src/Chunk.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'src/Chunk.cpp') diff --git a/src/Chunk.cpp b/src/Chunk.cpp index 09b0f0f99..4aa28d257 100644 --- a/src/Chunk.cpp +++ b/src/Chunk.cpp @@ -960,10 +960,9 @@ cItems cChunk::PickupsFromBlock(Vector3i a_RelPos, const cEntity * a_Digger, con cItems Pickups; const auto BlockEntity = GetBlockEntityRel(a_RelPos); - const auto ToolHandler = (a_Tool != nullptr) ? a_Tool->GetHandler() : cItemHandler::GetItemHandler(E_ITEM_EMPTY); - if (ToolHandler->CanHarvestBlock(BlockType)) + if ((a_Tool == nullptr) || a_Tool->GetHandler()->CanHarvestBlock(BlockType)) { - Pickups = cBlockHandler::For(BlockType).ConvertToPickups(BlockMeta, a_Digger, a_Tool); + Pickups = cBlockHandler::For(BlockType).ConvertToPickups(BlockMeta, a_Tool); if (BlockEntity != nullptr) { -- cgit v1.2.3