1
0

Crop blocks now respect water and light. Currently a block has to be "watered" or the crop has a chance of breaking anyways.

This commit is contained in:
Samuel Barney 2013-10-12 15:25:47 -06:00
parent 25c5df0e05
commit c74d1ffb91

View File

@ -78,10 +78,17 @@ public:
void OnUpdate(cWorld * a_World, int a_BlockX, int a_BlockY, int a_BlockZ) override
{
NIBBLETYPE Meta = a_World->GetBlockMeta(a_BlockX, a_BlockY, a_BlockZ);
if (Meta < 7)
NIBBLETYPE Water = a_World->GetBlockMeta(a_BlockX, a_BlockY - 1, a_BlockZ);
NIBBLETYPE Light = a_World->GetBlockBlockLight(a_BlockX, a_BlockY, a_BlockZ);
if ((Meta < 7) && (Water > 0) && (Light > 8))
{
a_World->FastSetBlock(a_BlockX, a_BlockY, a_BlockZ, E_BLOCK_CROPS, ++Meta);
}
else if ((!Water) || (Light < 9))
{
a_World->DigBlock(a_BlockX, a_BlockY, a_BlockZ);
}
}