Esempio n. 1
0
 private void SetToRoadBlock(int X, int Z, BlockManager bm)
 {
     //Average the 7x7 block surrounding the thing we are going to sample.
     int average = 0;
     for (int xx = -3; xx <= 3; ++xx) {
         for (int zz = -3; zz <= 3; ++zz) {
             average += bm.GetHeight (X + xx, Z + zz) - 1;
         }
     }
     average /= 49;
     //Set the block below the average to dirt, at the average to cobble, and everything above to air
     for (int y = average; y < bm.GetHeight(X, Z); ++y) {
         bm.SetID (X, y, Z, BlockInfo.Air.ID);
     }
     bm.SetID (X, average, Z, BlockInfo.Cobblestone.ID);
     bm.SetID (X, average - 1, Z, BlockInfo.Dirt.ID);
 }