1
0

Added cChunkDest::UpdateHeightmap()

This function is necessary for plugins manipulating the generated chunks, they need to update the heightmap before it is passed back to the generator.
This commit is contained in:
madmaxoft
2014-01-30 17:41:57 +01:00
parent 79ef653cb7
commit 66427d754b
2 changed files with 48 additions and 17 deletions

View File

@@ -562,6 +562,31 @@ cBlockEntity * cChunkDesc::GetBlockEntity(int a_RelX, int a_RelY, int a_RelZ)
void cChunkDesc::UpdateHeightmap(void)
{
for (int x = 0; x < cChunkDef::Width; x++)
{
for (int z = 0; z < cChunkDef::Width; z++)
{
int Height = 0;
for (int y = cChunkDef::Height - 1; y > 0; y--)
{
BLOCKTYPE BlockType = GetBlockType(x, y, z);
if (BlockType != E_BLOCK_AIR)
{
Height = y;
break;
}
} // for y
SetHeight(x, z, Height);
} // for z
} // for x
}
void cChunkDesc::CompressBlockMetas(cChunkDef::BlockNibbles & a_DestMetas)
{
const NIBBLETYPE * AreaMetas = m_BlockArea.GetBlockMetas();