1
0
Fork 0
cuberite-2a/src/Blocks/BlockCarpet.h

87 lines
1.7 KiB
C
Raw Normal View History

2013-08-05 08:43:43 +00:00
// BlockCarpet.h
// Declares the cBlockCarpetHandler class representing the handler for the carpet block
#pragma once
#include "BlockHandler.h"
2013-08-05 08:43:43 +00:00
class cBlockCarpetHandler:
2013-08-05 08:43:43 +00:00
public cBlockHandler
{
2020-04-13 16:38:06 +00:00
using Super = cBlockHandler;
2013-08-05 08:43:43 +00:00
public:
using Super::Super;
private:
2013-08-05 08:43:43 +00:00
virtual bool GetPlacementBlockTypeMeta(
cChunkInterface & a_ChunkInterface,
cPlayer & a_Player,
const Vector3i a_PlacedBlockPos,
eBlockFace a_ClickedBlockFace,
const Vector3i a_CursorPos,
2013-08-05 08:43:43 +00:00
BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta
) const override
2013-08-05 08:43:43 +00:00
{
a_BlockType = m_BlockType;
2017-07-31 20:17:52 +00:00
a_BlockMeta = a_Player.GetEquippedItem().m_ItemDamage & 0x0f;
2013-08-05 08:43:43 +00:00
return true;
}
2016-02-05 21:45:45 +00:00
2013-08-05 08:43:43 +00:00
virtual bool CanBeAt(cChunkInterface & a_ChunkInterface, const Vector3i a_RelPos, const cChunk & a_Chunk) const override
2013-08-05 08:43:43 +00:00
{
return (a_RelPos.y > 0) && (a_Chunk.GetBlock(a_RelPos.addedY(-1)) != E_BLOCK_AIR);
2013-08-05 08:43:43 +00:00
}
2015-06-30 14:50:15 +00:00
virtual ColourID GetMapBaseColourID(NIBBLETYPE a_Meta) const override
2015-06-30 14:50:15 +00:00
{
switch (a_Meta)
{
case E_META_CARPET_WHITE: return 14;
case E_META_CARPET_ORANGE: return 15;
case E_META_CARPET_MAGENTA: return 16;
case E_META_CARPET_LIGHTBLUE: return 17;
case E_META_CARPET_YELLOW: return 18;
case E_META_CARPET_LIGHTGREEN: return 19;
case E_META_CARPET_PINK: return 20;
case E_META_CARPET_GRAY: return 21;
case E_META_CARPET_LIGHTGRAY: return 22;
case E_META_CARPET_CYAN: return 23;
case E_META_CARPET_PURPLE: return 24;
case E_META_CARPET_BLUE: return 25;
case E_META_CARPET_BROWN: return 26;
case E_META_CARPET_GREEN: return 27;
case E_META_CARPET_RED: return 28;
case E_META_CARPET_BLACK: return 29;
default:
{
ASSERT(!"Unhandled meta in carpet handler!");
return 0;
}
}
}
2013-08-05 08:43:43 +00:00
} ;