Files
cuberite-2a/src/Blocks/BlockRedstone.h
T

71 lines
1.0 KiB
C++
Raw Normal View History

2013-07-29 12:13:03 +01:00
#pragma once
#include "BlockHandler.h"
2014-10-19 15:01:01 +02:00
#include "BlockSlab.h"
2013-07-29 12:13:03 +01:00
class cBlockRedstoneHandler final :
2020-03-23 22:07:08 +02:00
public cBlockHandler
2013-07-29 12:13:03 +01:00
{
2020-04-13 18:38:06 +02:00
using Super = cBlockHandler;
2013-07-29 12:13:03 +01:00
public:
using Super::Super;
2020-04-21 22:19:22 +02:00
private:
2020-04-21 22:19:22 +02:00
virtual bool CanBeAt(cChunkInterface & a_ChunkInterface, const Vector3i a_RelPos, const cChunk & a_Chunk) const override
2013-07-29 12:13:03 +01:00
{
2020-04-21 22:19:22 +02:00
if (a_RelPos.y <= 0)
2014-10-19 15:01:01 +02:00
{
return false;
}
BLOCKTYPE BelowBlock;
NIBBLETYPE BelowBlockMeta;
2020-04-21 22:19:22 +02:00
a_Chunk.GetBlockTypeMeta(a_RelPos.addedY(-1), BelowBlock, BelowBlockMeta);
2014-10-19 15:01:01 +02:00
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 12:13:03 +01:00
}
2016-02-05 23:45:45 +02:00
2020-04-21 22:19:22 +02:00
2020-09-23 16:06:27 +01:00
virtual cItems ConvertToPickups(NIBBLETYPE a_BlockMeta, const cEntity * a_Digger, const cItem * a_Tool) const override
2020-03-23 22:07:08 +02:00
{
return cItem(E_ITEM_REDSTONE_DUST, 1, 0);
}
2020-04-21 22:19:22 +02:00
virtual ColourID GetMapBaseColourID(NIBBLETYPE a_Meta) const override
2015-06-30 15:50:15 +01:00
{
UNUSED(a_Meta);
return 0;
}
2013-07-29 12:13:03 +01:00
} ;