2012-08-10 13:26:50 -07:00
|
|
|
|
2012-07-15 13:36:34 -07:00
|
|
|
#pragma once
|
|
|
|
#include "Block.h"
|
|
|
|
|
2012-08-10 13:26:50 -07:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class cBlockSugarcaneHandler :
|
|
|
|
public cBlockHandler
|
2012-07-15 13:36:34 -07:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
cBlockSugarcaneHandler(BLOCKTYPE a_BlockID)
|
|
|
|
: cBlockHandler(a_BlockID)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2012-08-10 13:26:50 -07:00
|
|
|
|
2012-07-16 12:20:37 -07:00
|
|
|
virtual bool NeedsRandomTicks() override
|
2012-07-15 13:36:34 -07:00
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2012-08-10 13:26:50 -07:00
|
|
|
|
2012-07-16 12:20:37 -07:00
|
|
|
virtual int GetDropID() override
|
2012-07-15 13:36:34 -07:00
|
|
|
{
|
|
|
|
return E_ITEM_SUGARCANE;
|
|
|
|
}
|
|
|
|
|
2012-08-10 13:26:50 -07:00
|
|
|
|
|
|
|
virtual bool CanBeAt(cWorld * a_World, int a_X, int a_Y, int a_Z) override
|
2012-07-15 13:36:34 -07:00
|
|
|
{
|
2012-08-10 13:26:50 -07:00
|
|
|
switch (a_World->GetBlock(a_X, a_Y - 1, a_Z))
|
|
|
|
{
|
|
|
|
case E_BLOCK_DIRT:
|
|
|
|
case E_BLOCK_GRASS:
|
|
|
|
case E_BLOCK_FARMLAND:
|
|
|
|
case E_BLOCK_SAND:
|
|
|
|
{
|
|
|
|
return a_World->IsBlockDirectlyWatered(a_X, a_Y - 1, a_Z);
|
|
|
|
}
|
|
|
|
case E_BLOCK_SUGARCANE:
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return false;
|
2012-07-15 13:36:34 -07:00
|
|
|
}
|
|
|
|
|
2012-08-10 13:26:50 -07:00
|
|
|
|
|
|
|
void OnUpdate(cWorld * a_World, int a_X, int a_Y, int a_Z) override
|
2012-07-15 13:36:34 -07:00
|
|
|
{
|
|
|
|
//TODO: Handle Growing here
|
|
|
|
}
|
2012-08-10 13:26:50 -07:00
|
|
|
|
2012-07-15 13:36:34 -07:00
|
|
|
|
2012-07-16 12:20:37 -07:00
|
|
|
virtual bool CanBePlacedOnSide() override
|
2012-07-15 13:36:34 -07:00
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
2012-08-10 13:26:50 -07:00
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|