Cuberite
A lightweight, fast and extensible game server for Minecraft
BlockBanner.h
Go to the documentation of this file.
1 
2 // BlockBanner.h
3 
4 #pragma once
5 
6 #include "../BlockInfo.h"
7 #include "BlockEntity.h"
8 
9 
10 
11 
12 
13 class cBlockBannerHandler final :
14  public cBlockEntityHandler
15 {
17 
18 public:
19 
20  using Super::Super;
21 
22  virtual cItems ConvertToPickups(const NIBBLETYPE a_BlockMeta, const cItem * const a_Tool) const override
23  {
24  // Drops handled by the block entity:
25  return {};
26  }
27 
28 
29 
30 
31 
32  virtual bool CanBeAt(const cChunk & a_Chunk, const Vector3i a_Position, const NIBBLETYPE a_Meta) const override
33  {
34  if (a_Position.y < 1)
35  {
36  return false;
37  }
38 
39  return cBlockInfo::IsSolid(a_Chunk.GetBlock(a_Position.addedY(-1)));
40  }
41 
42 
43 
44 
45 
46  virtual ColourID GetMapBaseColourID(NIBBLETYPE a_Meta) const override
47  {
48  UNUSED(a_Meta);
49  return 0;
50  }
51 } ;
unsigned char NIBBLETYPE
The datatype used by nibbledata (meta, light, skylight)
Definition: ChunkDef.h:44
Byte ColourID
Definition: Globals.h:162
#define UNUSED
Definition: Globals.h:72
static bool IsSolid(BLOCKTYPE Block)
Is this block solid (player cannot walk through)?
Definition: BlockInfo.cpp:892
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: BlockBanner.h:46
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: BlockBanner.h:32
virtual cItems ConvertToPickups(const NIBBLETYPE a_BlockMeta, const cItem *const a_Tool) const override
Returns the pickups that would result if the block was mined by a_Digger using a_Tool.
Definition: BlockBanner.h:22
Wrapper for blocks that have a cBlockEntity descendant attached to them and can be "used" by the play...
Definition: BlockEntity.h:16
cBlockHandler Super
Definition: BlockEntity.h:17
Definition: Chunk.h:36
BLOCKTYPE GetBlock(int a_RelX, int a_RelY, int a_RelZ) const
Definition: Chunk.h:146
Definition: Item.h:37
This class bridges a vector of cItem for safe access via Lua.
Definition: Item.h:215
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