2013-07-29 07:13:03 -04:00
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "BlockHandler.h"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-04-21 16:19:22 -04:00
|
|
|
class cBlockQuartzHandler:
|
|
|
|
public cBlockHandler
|
2013-07-29 07:13:03 -04:00
|
|
|
{
|
2020-04-21 16:19:22 -04:00
|
|
|
using Super = cBlockHandler;
|
|
|
|
|
2013-07-29 07:13:03 -04:00
|
|
|
public:
|
2020-04-21 16:19:22 -04:00
|
|
|
|
2020-09-20 09:50:52 -04:00
|
|
|
using Super::Super;
|
2020-04-21 16:19:22 -04:00
|
|
|
|
2020-09-20 09:50:52 -04:00
|
|
|
private:
|
2020-04-21 16:19:22 -04:00
|
|
|
|
2013-09-17 15:59:36 -04:00
|
|
|
virtual bool GetPlacementBlockTypeMeta(
|
2020-04-21 16:19:22 -04:00
|
|
|
cChunkInterface & a_ChunkInterface,
|
|
|
|
cPlayer & a_Player,
|
|
|
|
const Vector3i a_PlacedBlockPos,
|
|
|
|
eBlockFace a_ClickedBlockFace,
|
|
|
|
const Vector3i a_CursorPos,
|
2013-09-17 15:59:36 -04:00
|
|
|
BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta
|
2020-09-20 09:50:52 -04:00
|
|
|
) const override
|
2013-09-17 15:59:36 -04:00
|
|
|
{
|
|
|
|
a_BlockType = m_BlockType;
|
2020-04-21 16:19:22 -04:00
|
|
|
auto Meta = static_cast<NIBBLETYPE>(a_Player.GetEquippedItem().m_ItemDamage);
|
2014-08-19 16:14:37 -04:00
|
|
|
|
2020-04-21 16:19:22 -04:00
|
|
|
// Pillar block needs additional direction in the metadata:
|
|
|
|
if (Meta != E_META_QUARTZ_PILLAR)
|
2014-02-03 14:08:38 -05:00
|
|
|
{
|
2014-02-03 14:34:05 -05:00
|
|
|
a_BlockMeta = Meta;
|
2014-02-03 14:22:45 -05:00
|
|
|
return true;
|
2014-02-03 14:08:38 -05:00
|
|
|
}
|
2020-04-21 16:19:22 -04:00
|
|
|
a_BlockMeta = BlockFaceToMetaData(a_ClickedBlockFace);
|
2013-09-17 15:59:36 -04:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2020-04-21 16:19:22 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** Converts the block face of the pillar block's "base" to the block's metadata. */
|
|
|
|
inline static NIBBLETYPE BlockFaceToMetaData(eBlockFace a_BlockFace)
|
2013-09-17 15:59:36 -04:00
|
|
|
{
|
|
|
|
switch (a_BlockFace)
|
|
|
|
{
|
|
|
|
case BLOCK_FACE_YM:
|
|
|
|
case BLOCK_FACE_YP:
|
|
|
|
{
|
2020-04-21 16:19:22 -04:00
|
|
|
return E_META_QUARTZ_PILLAR; // Top or bottom
|
2013-09-17 15:59:36 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
case BLOCK_FACE_ZP:
|
|
|
|
case BLOCK_FACE_ZM:
|
|
|
|
{
|
2014-07-17 16:15:34 -04:00
|
|
|
return 0x4; // North or south
|
2013-09-17 15:59:36 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
case BLOCK_FACE_XP:
|
|
|
|
case BLOCK_FACE_XM:
|
|
|
|
{
|
2014-07-17 16:15:34 -04:00
|
|
|
return 0x3; // East or west
|
2013-09-17 15:59:36 -04:00
|
|
|
}
|
|
|
|
|
2020-04-21 16:19:22 -04:00
|
|
|
default:
|
2013-09-17 15:59:36 -04:00
|
|
|
{
|
2020-04-21 16:19:22 -04:00
|
|
|
return E_META_QUARTZ_PILLAR;
|
2013-09-17 15:59:36 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2015-06-30 10:50:15 -04:00
|
|
|
|
2020-04-21 16:19:22 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-09-20 09:50:52 -04:00
|
|
|
virtual ColourID GetMapBaseColourID(NIBBLETYPE a_Meta) const override
|
2015-06-30 10:50:15 -04:00
|
|
|
{
|
|
|
|
UNUSED(a_Meta);
|
|
|
|
return 8;
|
|
|
|
}
|
2014-02-04 13:59:05 -05:00
|
|
|
} ;
|