1
0
Fork 0
cuberite-2a/src/Items/ItemNetherWart.h

61 lines
929 B
C
Raw Normal View History

2013-12-18 17:33:18 +00:00
#pragma once
#include "ItemHandler.h"
#include "../World.h"
class cItemNetherWartHandler:
2013-12-18 17:33:18 +00:00
public cItemHandler
{
using Super = cItemHandler;
2013-12-18 17:33:18 +00:00
public:
cItemNetherWartHandler(int a_ItemType):
Super(a_ItemType)
{
2013-12-18 17:33:18 +00:00
}
2013-12-18 17:33:18 +00:00
virtual bool IsPlaceable(void) override
{
return true;
}
2013-12-18 17:33:18 +00:00
virtual bool GetPlacementBlockTypeMeta(
cWorld * a_World, cPlayer * a_Player,
const Vector3i a_PlacedBlockPos,
eBlockFace a_ClickedBlockFace,
const Vector3i a_CursorPos,
2013-12-18 17:33:18 +00:00
BLOCKTYPE & a_BlockType, NIBBLETYPE & a_BlockMeta
) override
{
// Only allow planting nether wart onto the top side of the block:
if (a_ClickedBlockFace != BLOCK_FACE_TOP)
2013-12-18 17:33:18 +00:00
{
return false;
}
2016-02-05 21:45:45 +00:00
// Only allow placement on soulsand
if ((a_PlacedBlockPos.y < 1) || (a_World->GetBlock(a_PlacedBlockPos.addedY(-1)) != E_BLOCK_SOULSAND))
2013-12-18 17:33:18 +00:00
{
return false;
}
a_BlockMeta = 0;
a_BlockType = E_BLOCK_NETHER_WART;
return true;
}
} ;