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