e6cc792cef
If no tool was involved in the creation of a bookshelf pickup (e.g. explosion), the server would crash due to a missing nullptr check. Removed the IsTool check completely, since we don't use it elsewhere, and vanilla doesn't do such checks either.
27 lines
490 B
C++
27 lines
490 B
C++
|
|
#pragma once
|
|
|
|
#include "BlockHandler.h"
|
|
|
|
|
|
|
|
|
|
class cBlockBookShelfHandler :
|
|
public cBlockHandler
|
|
{
|
|
public:
|
|
cBlockBookShelfHandler(BLOCKTYPE a_BlockType) :
|
|
cBlockHandler(a_BlockType)
|
|
{
|
|
}
|
|
|
|
virtual cItems ConvertToPickups(NIBBLETYPE a_BlockMeta, cBlockEntity * a_BlockEntity, const cEntity * a_Digger, const cItem * a_Tool) override
|
|
{
|
|
if (ToolHasSilkTouch(a_Tool))
|
|
{
|
|
return cItem(m_BlockType, 1);
|
|
}
|
|
return cItem(E_ITEM_BOOK, 3);
|
|
}
|
|
};
|