Grass blockticking fix
git-svn-id: http://mc-server.googlecode.com/svn/trunk@689 0a769ca7-a7f5-676a-18bf-c427514a06d6
This commit is contained in:
parent
ab860e6573
commit
02edaa4c81
@ -25,16 +25,20 @@ public:
|
|||||||
|
|
||||||
void OnUpdate(cWorld *a_World, int a_X, int a_Y, int a_Z) override
|
void OnUpdate(cWorld *a_World, int a_X, int a_Y, int a_Z) override
|
||||||
{
|
{
|
||||||
if(m_BlockID == E_BLOCK_GRASS)
|
if (m_BlockID != E_BLOCK_GRASS)
|
||||||
{
|
{
|
||||||
//Grass becomes dirt if there is something on top of them
|
return;
|
||||||
BLOCKTYPE Above = a_World->GetBlock(a_X, a_Y + 1, a_Z);
|
|
||||||
if(!g_BlockTransparent[Above] && !g_BlockOneHitDig[Above])
|
|
||||||
{
|
|
||||||
a_World->FastSetBlock(a_X, a_Y, a_Z, E_BLOCK_DIRT, 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Grass becomes dirt if there is something on top of it:
|
||||||
|
BLOCKTYPE Above = a_World->GetBlock(a_X, a_Y + 1, a_Z);
|
||||||
|
if (!g_BlockTransparent[Above] && !g_BlockOneHitDig[Above])
|
||||||
|
{
|
||||||
|
a_World->FastSetBlock(a_X, a_Y, a_Z, E_BLOCK_DIRT, 0);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Grass spreads to adjacent blocks:
|
||||||
MTRand rand;
|
MTRand rand;
|
||||||
for (int i = 0; i < 2; i++) // Pick two blocks to grow to
|
for (int i = 0; i < 2; i++) // Pick two blocks to grow to
|
||||||
{
|
{
|
||||||
@ -58,8 +62,6 @@ public:
|
|||||||
a_World->FastSetBlock(a_X + OfsX, a_Y + OfsY, a_Z + OfsZ, E_BLOCK_GRASS, 0);
|
a_World->FastSetBlock(a_X + OfsX, a_Y + OfsY, a_Z + OfsZ, E_BLOCK_GRASS, 0);
|
||||||
}
|
}
|
||||||
} // for i - repeat twice
|
} // for i - repeat twice
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
Loading…
Reference in New Issue
Block a user