public void PopulateChunk(ChunkColumn chunk) { var layers = BlockLayers; for (int x = 0; x < 16; x++) { for (int z = 0; z < 16; z++) { int h = 0; foreach (var layer in layers) { chunk.SetBlock(x, h, z, layer.Id); chunk.SetMetadata(x, h, z, layer.Metadata); h++; } chunk.SetHeight(x, z, (short)h); for (int i = h + Dimension == Dimension.Overworld ? 1 : 0; i >= 0; i--) { chunk.SetSkyLight(x, i, z, 0); } // need to take care of skylight for non overworld to make it 0. chunk.SetBiome(x, z, 1); // use pattern for this } } }
public int PopulateChunk(ChunkColumn chunk) { //var random = new CryptoRandom(); //var stones = new byte[16*16*16]; int h = 0; for (int x = 0; x < 16; x++) { for (int z = 0; z < 16; z++) { h = 0; chunk.SetBlock(x, h++, z, 7); // Bedrock //stones[i + h++] = 1; // Stone //stones[i + h++] = 1; // Stone //switch (random.Next(0, 20)) //{ // case 0: // stones[i + h++] = 3; // Dirt // stones[i + h++] = 3; // break; // case 1: // stones[i + h++] = 1; // Stone // stones[i + h++] = 1; // Stone // break; // case 2: // stones[i + h++] = 13; // Gravel // stones[i + h++] = 13; // Gravel // break; // case 3: // stones[i + h++] = 14; // Gold // stones[i + h++] = 14; // Gold // break; // case 4: // stones[i + h++] = 16; // Cole // stones[i + h++] = 16; // Cole // break; // case 5: // stones[i + h++] = 56; // Dimond // stones[i + h++] = 56; // Dimond // break; // default: // stones[i + h++] = 1; // Stone // stones[i + h++] = 1; // Stone // break; //} chunk.SetBlock(x, h++, z, 3); // Dirt chunk.SetBlock(x, h++, z, 3); // Dirt chunk.SetBlock(x, h++, z, 2); // Grass chunk.SetHeight(x, z, (short)h); for (int i = h - 1; i >= 0; i--) { chunk.SetSkyLight(x, i, z, 0); } chunk.SetBiome(x, z, 1); } } return(h); }