Cuberite
A lightweight, fast and extensible game server for Minecraft
BlockMobHead.h
Go to the documentation of this file.
1 
2 #pragma once
3 
4 #include "BlockEntity.h"
5 #include "../BlockEntities/MobHeadEntity.h"
6 
7 
8 
9 
10 
12  public cBlockEntityHandler
13 {
15 
16 public:
18  super(a_BlockType)
19  {
20  }
21 
22 
23 
24 
25 
26  virtual cItems ConvertToPickups(NIBBLETYPE a_BlockMeta, cBlockEntity * a_BlockEntity, const cEntity * a_Digger, const cItem * a_Tool) override
27  {
28  if ((a_BlockEntity == nullptr) || (a_BlockEntity->GetBlockType() != E_BLOCK_HEAD))
29  {
30  return {};
31  }
32  auto mobHeadEntity = static_cast<cMobHeadEntity *>(a_BlockEntity);
33  return cItem(E_ITEM_HEAD, 1, static_cast<short>(mobHeadEntity->GetType()));
34  }
35 
36 
37 
38 
39 
40  virtual ColourID GetMapBaseColourID(NIBBLETYPE a_Meta) override
41  {
42  UNUSED(a_Meta);
43  return 0;
44  }
45 } ;
46 
47 
48 
49 
Wrapper for blocks that have a cBlockEntity descendant attached to them and can be "used" by the play...
Definition: BlockEntity.h:15
BLOCKTYPE GetBlockType() const
Definition: BlockEntity.h:111
unsigned char BLOCKTYPE
The datatype used by blockdata.
Definition: ChunkDef.h:42
unsigned char NIBBLETYPE
The datatype used by nibbledata (meta, light, skylight)
Definition: ChunkDef.h:45
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: BlockMobHead.h:26
cBlockMobHeadHandler(BLOCKTYPE a_BlockType)
Definition: BlockMobHead.h:17
#define UNUSED
Definition: Globals.h:152
Byte ColourID
Definition: Globals.h:118
Definition: Entity.h:73
cBlockEntityHandler(BLOCKTYPE a_BlockType)
Definition: BlockEntity.h:22
Definition: Item.h:36
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: BlockMobHead.h:40
This class bridges a vector of cItem for safe access via Lua.
Definition: Item.h:234