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