Cuberite
A lightweight, fast and extensible game server for Minecraft
BlockPlanks.h
Go to the documentation of this file.
1 
2 #pragma once
3 
4 #include "BlockHandler.h"
5 
6 
7 
8 
9 
11 {
12 public:
14  : cBlockHandler(a_BlockType)
15  {
16  }
17 
19  cChunkInterface & a_ChunkInterface, cPlayer & a_Player,
20  int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace,
21  int a_CursorX, int a_CursorY, int a_CursorZ,
22  BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta
23  ) override
24  {
25  a_BlockType = m_BlockType;
26  a_BlockMeta = static_cast<NIBBLETYPE>(a_Player.GetEquippedItem().m_ItemDamage);
27  return true;
28  }
29 
30  virtual ColourID GetMapBaseColourID(NIBBLETYPE a_Meta) override
31  {
32  switch (a_Meta)
33  {
34  case E_META_PLANKS_BIRCH: return 2;
35  case E_META_PLANKS_JUNGLE: return 10;
36  case E_META_PLANKS_OAK: return 13;
37  case E_META_PLANKS_ACACIA: return 15;
38  case E_META_PLANKS_DARK_OAK: return 26;
39  case E_META_PLANKS_SPRUCE: return 34;
40  default:
41  {
42  ASSERT(!"Unhandled meta in planks handler!");
43  return 0;
44  }
45  }
46  }
47 } ;
48 
49 
50 
51 
cBlockPlanksHandler(BLOCKTYPE a_BlockType)
Definition: BlockPlanks.h:13
virtual bool GetPlacementBlockTypeMeta(cChunkInterface &a_ChunkInterface, cPlayer &a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ, BLOCKTYPE &a_BlockType, NIBBLETYPE &a_BlockMeta) override
Called before a block is placed into a world.
Definition: BlockPlanks.h:18
short m_ItemDamage
Definition: Item.h:211
unsigned char BLOCKTYPE
The datatype used by blockdata.
Definition: ChunkDef.h:42
const cItem & GetEquippedItem(void) const
Definition: Player.h:142
Definition: Player.h:27
BLOCKTYPE m_BlockType
Definition: BlockHandler.h:213
unsigned char NIBBLETYPE
The datatype used by nibbledata (meta, light, skylight)
Definition: ChunkDef.h:45
#define ASSERT(x)
Definition: Globals.h:335
eBlockFace
Block face constants, used in PlayerDigging and PlayerBlockPlacement packets and bbox collision calc...
Definition: Defines.h:29
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: BlockPlanks.h:30
Byte ColourID
Definition: Globals.h:118