Cuberite
A lightweight, fast and extensible game server for Minecraft
BlockLilypad.h
Go to the documentation of this file.
1 
2 #pragma once
3 
4 #include "BlockHandler.h"
5 
6 
7 
8 
9 
11  public cClearMetaOnDrop<cBlockHandler>
12 {
14 public:
15 
17  super(a_BlockType)
18  {
19  }
20 
21  virtual ColourID GetMapBaseColourID(NIBBLETYPE a_Meta) override
22  {
23  UNUSED(a_Meta);
24  return 7;
25  }
26 
27 
28  virtual bool CanBeAt(cChunkInterface & a_ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, const cChunk & a_Chunk) override
29  {
30  if ((a_RelY < 1) || (a_RelY >= cChunkDef::Height))
31  {
32  return false;
33  }
34  BLOCKTYPE UnderType;
35  NIBBLETYPE UnderMeta;
36  a_Chunk.GetBlockTypeMeta(a_RelX, a_RelY - 1, a_RelZ, UnderType, UnderMeta);
37  return (
38  (((UnderType == E_BLOCK_STATIONARY_WATER) || (UnderType == E_BLOCK_WATER)) && (UnderMeta == 0)) || // A water source is below
39  (UnderType == E_BLOCK_ICE) || (UnderType == E_BLOCK_FROSTED_ICE) // Or (frosted) ice
40  );
41  }
42 };
43 
44 
45 
46 
cClearMetaOnDrop< cBlockHandler > super
Definition: BlockLilypad.h:13
cBlockLilypadHandler(BLOCKTYPE a_BlockType)
Definition: BlockLilypad.h:16
void GetBlockTypeMeta(Vector3i a_RelPos, BLOCKTYPE &a_BlockType, NIBBLETYPE &a_BlockMeta) const
Definition: Chunk.cpp:2230
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
Definition: Chunk.h:49
static const int Height
Definition: ChunkDef.h:135
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: BlockLilypad.h:21
#define UNUSED
Definition: Globals.h:152
Byte ColourID
Definition: Globals.h:118
Mixin to clear the block&#39;s meta value when converting to a pickup.
Definition: Mixins.h:55
virtual bool CanBeAt(cChunkInterface &a_ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, const cChunk &a_Chunk) override
Checks if the block can stay at the specified relative coords in the chunk.
Definition: BlockLilypad.h:28