void parseChunk(Chunk toparse, Form1 thisform)
{
// Get all of the blocks, and load them into memory.
for (byte i = 0; i < 16; i++)
{
if (Convert.ToBoolean(toparse.pbitmap & (1 << i)))
{
for (int f= 0; f < 4096; f++)
{
int blockX = (toparse.x * 16) + (f & 0x0F); // f & 0x0f
int blockY = (i * 16) + (blockX >> 8); // i*16 + (f >> 8)
int blockZ = (toparse.z * 16) + (f & 0xF0) >> 4; // (f & F0) >> 4
int blockID = toparse.blocks[f];
MapBlock myBlock = new MapBlock(blockID, blockX, blockY, blockZ);
if (thisform.blocks == null)
thisform.blocks = new MapBlock[] { myBlock };
else
{
MapBlock[] temp = thisform.blocks;
thisform.blocks = new MapBlock[temp.Length + 1];
Array.Copy(temp, thisform.blocks, temp.Length);
thisform.blocks[temp.Length] = myBlock;
}
}
}
}
}