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

77 lines
1.1 KiB
C
Raw Normal View History

2014-03-16 19:26:13 +00:00
#pragma once
#include "BlockHandler.h"
class cBlockCakeHandler:
2014-03-16 19:26:13 +00:00
public cBlockHandler
{
2020-04-13 16:38:06 +00:00
using Super = cBlockHandler;
public:
using Super::Super;
private:
virtual bool OnUse(
cChunkInterface & a_ChunkInterface,
cWorldInterface & a_WorldInterface,
cPlayer & a_Player,
const Vector3i a_BlockPos,
eBlockFace a_BlockFace,
const Vector3i a_CursorPos
) const override
2014-03-16 19:26:13 +00:00
{
NIBBLETYPE Meta = a_ChunkInterface.GetBlockMeta(a_BlockPos);
2014-03-16 19:26:13 +00:00
2017-07-31 20:17:52 +00:00
if (!a_Player.Feed(2, 0.4))
2014-03-16 19:26:13 +00:00
{
return false;
2014-03-16 19:26:13 +00:00
}
2016-02-05 21:45:45 +00:00
a_Player.GetStatManager().AddValue(Statistic::EatCakeSlice);
2014-03-16 19:57:23 +00:00
if (Meta >= 5)
2014-03-16 19:26:13 +00:00
{
a_ChunkInterface.DigBlock(a_WorldInterface, a_BlockPos);
2014-03-16 19:26:13 +00:00
}
else
{
a_ChunkInterface.SetBlockMeta(a_BlockPos, Meta + 1);
2014-03-16 19:26:13 +00:00
}
return true;
2014-03-16 19:26:13 +00:00
}
virtual cItems ConvertToPickups(NIBBLETYPE a_BlockMeta, cBlockEntity * a_BlockEntity, const cEntity * a_Digger, const cItem * a_Tool) const override
2014-03-16 19:26:13 +00:00
{
// Give nothing
return {};
2014-03-16 19:26:13 +00:00
}
virtual bool IsUseable(void) const override
2014-03-16 19:26:13 +00:00
{
return true;
}
2015-06-30 14:50:15 +00:00
virtual ColourID GetMapBaseColourID(NIBBLETYPE a_Meta) const override
2015-06-30 14:50:15 +00:00
{
UNUSED(a_Meta);
return 14;
}
2014-03-16 19:26:13 +00:00
} ;