Cuberite
A lightweight, fast and extensible game server for Minecraft
BlockCarpet.h
Go to the documentation of this file.
1 
2 // BlockCarpet.h
3 
4 // Declares the cBlockCarpetHandler class representing the handler for the carpet block
5 
6 
7 
8 
9 #pragma once
10 
11 #include "BlockHandler.h"
12 
13 
14 
15 
16 
17 class cBlockCarpetHandler final :
18  public cBlockHandler
19 {
21 
22 public:
23 
24  using Super::Super;
25 
26 private:
27 
28  virtual bool CanBeAt(const cChunk & a_Chunk, const Vector3i a_Position, const NIBBLETYPE a_Meta) const override
29  {
30  return (a_Position.y > 0) && (a_Chunk.GetBlock(a_Position.addedY(-1)) != E_BLOCK_AIR);
31  }
32 
33 
34 
35 
36 
37  virtual ColourID GetMapBaseColourID(NIBBLETYPE a_Meta) const override
38  {
39  switch (a_Meta)
40  {
41  case E_META_CARPET_WHITE: return 14;
42  case E_META_CARPET_ORANGE: return 15;
43  case E_META_CARPET_MAGENTA: return 16;
44  case E_META_CARPET_LIGHTBLUE: return 17;
45  case E_META_CARPET_YELLOW: return 18;
46  case E_META_CARPET_LIGHTGREEN: return 19;
47  case E_META_CARPET_PINK: return 20;
48  case E_META_CARPET_GRAY: return 21;
49  case E_META_CARPET_LIGHTGRAY: return 22;
50  case E_META_CARPET_CYAN: return 23;
51  case E_META_CARPET_PURPLE: return 24;
52  case E_META_CARPET_BLUE: return 25;
53  case E_META_CARPET_BROWN: return 26;
54  case E_META_CARPET_GREEN: return 27;
55  case E_META_CARPET_RED: return 28;
56  case E_META_CARPET_BLACK: return 29;
57  default:
58  {
59  ASSERT(!"Unhandled meta in carpet handler!");
60  return 0;
61  }
62  }
63  }
64 } ;
65 
66 
67 
68 
@ E_META_CARPET_LIGHTGRAY
Definition: BlockType.h:587
@ E_META_CARPET_YELLOW
Definition: BlockType.h:583
@ E_META_CARPET_MAGENTA
Definition: BlockType.h:581
@ E_META_CARPET_GREEN
Definition: BlockType.h:592
@ E_META_CARPET_ORANGE
Definition: BlockType.h:580
@ E_META_CARPET_BROWN
Definition: BlockType.h:591
@ E_META_CARPET_WHITE
Definition: BlockType.h:579
@ E_META_CARPET_LIGHTBLUE
Definition: BlockType.h:582
@ E_META_CARPET_PURPLE
Definition: BlockType.h:589
@ E_META_CARPET_LIGHTGREEN
Definition: BlockType.h:584
@ E_META_CARPET_PINK
Definition: BlockType.h:585
@ E_META_CARPET_CYAN
Definition: BlockType.h:588
@ E_META_CARPET_RED
Definition: BlockType.h:593
@ E_META_CARPET_GRAY
Definition: BlockType.h:586
@ E_META_CARPET_BLUE
Definition: BlockType.h:590
@ E_META_CARPET_BLACK
Definition: BlockType.h:594
@ E_BLOCK_AIR
Definition: BlockType.h:10
unsigned char NIBBLETYPE
The datatype used by nibbledata (meta, light, skylight)
Definition: ChunkDef.h:44
Byte ColourID
Definition: Globals.h:162
#define ASSERT(x)
Definition: Globals.h:276
virtual ColourID GetMapBaseColourID(NIBBLETYPE a_Meta) const override
Returns the base colour ID of the block, as will be represented on a map, as per documentation: https...
Definition: BlockCarpet.h:37
virtual bool CanBeAt(const cChunk &a_Chunk, const Vector3i a_Position, const NIBBLETYPE a_Meta) const override
Checks if the block can stay at the specified relative coords in the chunk.
Definition: BlockCarpet.h:28
constexpr cBlockHandler(BLOCKTYPE a_BlockType)
Definition: BlockHandler.h:29
Definition: Chunk.h:36
BLOCKTYPE GetBlock(int a_RelX, int a_RelY, int a_RelZ) const
Definition: Chunk.h:146
Vector3< T > addedY(T a_AddY) const
Returns a copy of this vector moved by the specified amount on the y axis.
Definition: Vector3.h:314
T y
Definition: Vector3.h:17