Cuberite
A lightweight, fast and extensible game server for Minecraft
BlockGlass.h
Go to the documentation of this file.
1 
2 #pragma once
3 
4 #include "BlockHandler.h"
5 
6 
7 
8 
9 
11  public cBlockHandler
12 {
13 public:
15  : cBlockHandler(a_BlockType)
16  {
17  }
18 
19 
20 
21 
22 
23  virtual cItems ConvertToPickups(NIBBLETYPE a_BlockMeta, cBlockEntity * a_BlockEntity, const cEntity * a_Digger, const cItem * a_Tool) override
24  {
25  // Only drop self when mined with silk-touch:
26  if (ToolHasSilkTouch(a_Tool))
27  {
28  return cItem(m_BlockType, 1, a_BlockMeta);
29  }
30  return {};
31  }
32 
33 
34 
35 
36 
37  virtual ColourID GetMapBaseColourID(NIBBLETYPE a_Meta) override
38  {
39  UNUSED(a_Meta);
40  return 0;
41  }
42 } ;
43 
44 
45 
46 
unsigned char BLOCKTYPE
The datatype used by blockdata.
Definition: ChunkDef.h:42
BLOCKTYPE m_BlockType
Definition: BlockHandler.h:213
unsigned char NIBBLETYPE
The datatype used by nibbledata (meta, light, skylight)
Definition: ChunkDef.h:45
static bool ToolHasSilkTouch(const cItem *a_Tool)
Returns true if the specified tool is valid and has a non-zero silk-touch enchantment.
virtual cItems ConvertToPickups(NIBBLETYPE a_BlockMeta, cBlockEntity *a_BlockEntity, const cEntity *a_Digger, const cItem *a_Tool) override
Returns the pickups that would result if the block was mined by a_Digger using a_Tool.
Definition: BlockGlass.h:23
#define UNUSED
Definition: Globals.h:152
cBlockGlassHandler(BLOCKTYPE a_BlockType)
Definition: BlockGlass.h:14
Byte ColourID
Definition: Globals.h:118
Definition: Entity.h:73
virtual ColourID GetMapBaseColourID(NIBBLETYPE a_Meta) override
Returns the base colour ID of the block, as will be represented on a map, as per documentation: https...
Definition: BlockGlass.h:37
Definition: Item.h:36
This class bridges a vector of cItem for safe access via Lua.
Definition: Item.h:234