blob: de8e59a402bf2ab2c983a160670b1bdf1a696afb (
plain) (
tree)
|
|
#pragma once
#include "BlockHandler.h"
#include "BlockSlab.h"
#include "BlockStairs.h"
#include "../Chunk.h"
class cBlockRedstoneWireHandler final :
public cBlockHandler
{
using Super = cBlockHandler;
public:
using Super::Super;
private:
virtual bool CanBeAt(const cChunk & a_Chunk, const Vector3i a_Position, const NIBBLETYPE a_Meta) const override
{
if (a_Position.y <= 0)
{
return false;
}
BLOCKTYPE BelowBlock;
NIBBLETYPE BelowBlockMeta;
a_Chunk.GetBlockTypeMeta(a_Position.addedY(-1), BelowBlock, BelowBlockMeta);
if (cBlockInfo::FullyOccupiesVoxel(BelowBlock))
{
return true;
}
// upside down slabs
if (cBlockSlabHandler::IsAnySlabType(BelowBlock))
{
return BelowBlockMeta & E_META_WOODEN_SLAB_UPSIDE_DOWN;
}
// upside down stairs
if (cBlockStairsHandler::IsAnyStairType(BelowBlock))
{
return BelowBlockMeta & E_BLOCK_STAIRS_UPSIDE_DOWN;
}
return false;
}
virtual cItems ConvertToPickups(const NIBBLETYPE a_BlockMeta, const cItem * const a_Tool) const override
{
return cItem(E_ITEM_REDSTONE_DUST, 1, 0);
}
virtual ColourID GetMapBaseColourID(NIBBLETYPE a_Meta) const override
{
UNUSED(a_Meta);
return 0;
}
} ;
|