Cuberite
A lightweight, fast and extensible game server for Minecraft
BlockBookShelf.h
Go to the documentation of this file.
1 
2 #pragma once
3 
4 #include "BlockHandler.h"
5 
6 
7 
8 
9 class cBlockBookShelfHandler final :
10  public cBlockHandler
11 {
12 public:
13 
15 
16 private:
17 
18  virtual cItems ConvertToPickups(const NIBBLETYPE a_BlockMeta, const cItem * const a_Tool) const override
19  {
20  if (ToolHasSilkTouch(a_Tool))
21  {
22  return cItem(m_BlockType, 1);
23  }
24  return cItem(E_ITEM_BOOK, 3);
25  }
26 };
@ E_ITEM_BOOK
Definition: BlockType.h:385
unsigned char NIBBLETYPE
The datatype used by nibbledata (meta, light, skylight)
Definition: ChunkDef.h:44
virtual cItems ConvertToPickups(const NIBBLETYPE a_BlockMeta, const cItem *const a_Tool) const override
Returns the pickups that would result if the block was mined by a_Digger using a_Tool.
static bool ToolHasSilkTouch(const cItem *a_Tool)
Returns true if the specified tool is valid and has a non-zero silk-touch enchantment.
constexpr cBlockHandler(BLOCKTYPE a_BlockType)
Definition: BlockHandler.h:29
const BLOCKTYPE m_BlockType
Definition: BlockHandler.h:205
Definition: Item.h:37
This class bridges a vector of cItem for safe access via Lua.
Definition: Item.h:215