- int X_index, Y_index, Z_index;
- X_index = Y_index = Z_index = 0;
-
- do
- {
- do
- {
- do
- {
- /* Encode packed indicie
- (y * chunksize + z) * chunksize + x
- */
- var indicie = Helpers.ChunkBlockIndicie16(X_index, Y_index, Z_index);
- int aBlockId = chunkData.Blocks[indicie];
-
- if (aBlockId == 0)
- {//Air
- chunkMeta.AirBlocks++;
- continue;
- }
-
- if (RockIdCodes.ContainsKey(aBlockId))
- {
- if (chunkMeta.RockRatio.ContainsKey(aBlockId)) { chunkMeta.RockRatio[aBlockId]++; } else { chunkMeta.RockRatio.Add(aBlockId, 1); }
- }
-
- chunkMeta.NonAirBlocks++;
-
- //Heightmap
- if (chunkMeta.HeightMap[X_index, Z_index] == 0)
- { chunkMeta.HeightMap[X_index, Z_index] = (ushort) (Y_index + (targetChunkY * chunkSize)); }
-
- }
- while (X_index++ < (chunkSize - 1));
- X_index = 0;
- }
- while (Z_index++ < (chunkSize - 1));
- Z_index = 0;
- }
- while (Y_index++ < (chunkSize - 1));
+ //int X_index, Y_index, Z_index;
+
+ //Ensure ChunkData Metadata fields arn't null...due to being tossed out
+ //if (chunkMeta.HeightMap == null) { chunkMeta.HeightMap = new ushort[chunkSize, chunkSize]; }
+ //if (chunkMeta.RockRatio == null) { chunkMeta.RockRatio = new Dictionary<int, uint>(10); }
+
+ //for (Y_index = 0; Y_index < chunkSize - 1; Y_index++)
+ //{
+ // for (Z_index = 0; Z_index < chunkSize - 1; Z_index++)
+ // {
+ // for (X_index = 0; X_index < chunkSize - 1; X_index++)
+ // {
+ // /* Encode packed indicie
+ // (y * chunksize + z) * chunksize + x
+ // */
+ // var indicie = Helpers.ChunkBlockIndicie16(X_index, Y_index, Z_index);
+ // int aBlockId = chunkData.Blocks[indicie];
+
+ // if (aBlockId == 0)
+ // {//Air
+ // chunkMeta.AirBlocks++;
+ // continue;
+ // }
+
+ // if (RockIdCodes.ContainsKey(aBlockId))
+ // {
+ // if (chunkMeta.RockRatio.ContainsKey(aBlockId))
+ // chunkMeta.RockRatio[aBlockId]++;
+ // else
+ // chunkMeta.RockRatio.Add(aBlockId, 1);
+ // }
+
+ // chunkMeta.NonAirBlocks++;
+
+ // //Heightmap
+ // //if (chunkMeta.HeightMap[X_index, Z_index] == 0)
+ // //{
+
+ // // chunkMeta.HeightMap[X_index, Z_index] = (ushort) (Y_index + (targetChunkY * chunkSize));
+ // //}
+ // }
+ // }
+
+ //}