2013-07-29 07:13:03 -04:00
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "BlockHandler.h"
|
|
|
|
#include "../World.h"
|
2014-10-19 09:01:01 -04:00
|
|
|
#include "BlockSlab.h"
|
2013-07-29 07:13:03 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class cBlockRedstoneHandler :
|
|
|
|
public cBlockHandler
|
|
|
|
{
|
|
|
|
public:
|
2013-11-29 17:25:07 -05:00
|
|
|
cBlockRedstoneHandler(BLOCKTYPE a_BlockType)
|
|
|
|
: cBlockHandler(a_BlockType)
|
|
|
|
{
|
|
|
|
}
|
2014-10-19 09:01:01 -04:00
|
|
|
|
|
|
|
|
2013-07-29 07:13:03 -04:00
|
|
|
|
2014-02-01 08:06:32 -05:00
|
|
|
virtual bool CanBeAt(cChunkInterface & a_ChunkInterface, int a_RelX, int a_RelY, int a_RelZ, const cChunk & a_Chunk) override
|
2013-07-29 07:13:03 -04:00
|
|
|
{
|
2014-10-19 09:01:01 -04:00
|
|
|
if (a_RelY <= 0)
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
BLOCKTYPE BelowBlock;
|
|
|
|
NIBBLETYPE BelowBlockMeta;
|
|
|
|
a_Chunk.GetBlockTypeMeta(a_RelX, a_RelY - 1, a_RelZ, BelowBlock, BelowBlockMeta);
|
|
|
|
|
|
|
|
if (cBlockInfo::FullyOccupiesVoxel(BelowBlock))
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
else if (cBlockSlabHandler::IsAnySlabType(BelowBlock))
|
|
|
|
{
|
|
|
|
// Check if the slab is turned up side down
|
|
|
|
if ((BelowBlockMeta & 0x08) == 0x08)
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return false;
|
2013-07-29 07:13:03 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override
|
|
|
|
{
|
2014-08-19 16:14:37 -04:00
|
|
|
// Reset meta to zero
|
|
|
|
a_Pickups.push_back(cItem(E_ITEM_REDSTONE_DUST, 1, 0));
|
2013-07-29 07:13:03 -04:00
|
|
|
}
|
|
|
|
} ;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|