1
0
Fork 0
cuberite-2a/src/Blocks/BlockLilypad.h

51 lines
938 B
C
Raw Normal View History

2014-03-23 22:32:45 +00:00
#pragma once
#include "BlockHandler.h"
2017-08-06 19:57:44 +00:00
2014-03-23 22:32:45 +00:00
2020-04-13 16:38:06 +00:00
class cBlockLilypadHandler:
2014-07-14 23:01:16 +00:00
public cClearMetaOnDrop<cBlockHandler>
2014-03-23 22:32:45 +00:00
{
2020-04-13 16:38:06 +00:00
using Super = cClearMetaOnDrop<cBlockHandler>;
2014-03-23 22:32:45 +00:00
public:
2014-07-15 12:54:24 +00:00
using Super::Super;
private:
virtual ColourID GetMapBaseColourID(NIBBLETYPE a_Meta) const override
2015-06-30 14:50:15 +00:00
{
UNUSED(a_Meta);
return 7;
}
virtual bool CanBeAt(cChunkInterface & a_ChunkInterface, const Vector3i a_RelPos, const cChunk & a_Chunk) const override
{
auto UnderPos = a_RelPos.addedY(-1);
if (!cChunkDef::IsValidHeight(UnderPos.y))
{
return false;
}
BLOCKTYPE UnderType;
NIBBLETYPE UnderMeta;
a_Chunk.GetBlockTypeMeta(UnderPos, UnderType, UnderMeta);
return (
(((UnderType == E_BLOCK_STATIONARY_WATER) || (UnderType == E_BLOCK_WATER)) && (UnderMeta == 0)) || // A water source is below
(UnderType == E_BLOCK_ICE) || (UnderType == E_BLOCK_FROSTED_ICE) // Or (frosted) ice
);
}
2014-03-23 22:32:45 +00:00
};