1
0
cuberite-2a/src/Blocks/BlockCake.h

58 lines
1.0 KiB
C
Raw Normal View History

2014-03-16 15:26:13 -04:00
#pragma once
#include "BlockHandler.h"
class cBlockCakeHandler :
public cBlockHandler
{
public:
cBlockCakeHandler(BLOCKTYPE a_BlockType)
: cBlockHandler(a_BlockType)
{
}
2016-02-05 16:45:45 -05:00
2017-07-31 16:17:52 -04:00
virtual bool OnUse(cChunkInterface & a_ChunkInterface, cWorldInterface & a_WorldInterface, cPlayer & a_Player, int a_BlockX, int a_BlockY, int a_BlockZ, eBlockFace a_BlockFace, int a_CursorX, int a_CursorY, int a_CursorZ) override
2014-03-16 15:26:13 -04:00
{
NIBBLETYPE Meta = a_ChunkInterface.GetBlockMeta({a_BlockX, a_BlockY, a_BlockZ});
2014-03-16 15:26:13 -04:00
2017-07-31 16:17:52 -04:00
if (!a_Player.Feed(2, 0.4))
2014-03-16 15:26:13 -04:00
{
return false;
2014-03-16 15:26:13 -04:00
}
2016-02-05 16:45:45 -05:00
2014-03-16 15:57:23 -04:00
if (Meta >= 5)
2014-03-16 15:26:13 -04:00
{
a_ChunkInterface.FastSetBlock(a_BlockX, a_BlockY, a_BlockZ, E_BLOCK_AIR, 0);
}
else
{
a_ChunkInterface.SetBlockMeta(a_BlockX, a_BlockY, a_BlockZ, Meta + 1);
}
return true;
2014-03-16 15:26:13 -04:00
}
virtual void ConvertToPickups(cItems & a_Pickups, NIBBLETYPE a_BlockMeta) override
{
// Give nothing
}
virtual bool IsUseable(void) override
{
return true;
}
2015-06-30 10:50:15 -04:00
virtual ColourID GetMapBaseColourID(NIBBLETYPE a_Meta) override
{
UNUSED(a_Meta);
return 14;
}
2014-03-16 15:26:13 -04:00
} ;