Пример #1
0
        public override void Decorate(Chunk C, int X, byte Y, int Z)
        {
            for (int I = 0; I < 64; I++)
            {
                int  _X = X + R.Next(8) - R.Next(8);
                byte _Y = (byte)(Y + R.Next(4) - R.Next(4));
                int  _Z = Z + R.Next(8) - R.Next(8);

                if (C.GetBlock(new BlockLocation(_X, (byte)(_Y - 1), _Z, C.World)).Equals(MaterialManager.GetBlock(2)) && C.GetBlock(new BlockLocation(_X, _Y, _Z, C.World)).Equals(MaterialManager.GetBlock(0)))
                {
                    C.SetBlock(new BlockLocation(_X, _Y, _Z, C.World), MaterialManager.GetMaterial(ID), Meta);
                }
            }
        }
Пример #2
0
        public override void Decorate(Chunk C, int X, byte Y, int Z)
        {
            for (int I = 0; I < 10; I++)
            {
                int  _X = X + R.Next(8) - R.Next(8);
                byte _Y = (byte)(Y + R.Next(4) - R.Next(4));
                int  _Z = Z + R.Next(8) - R.Next(8);
                byte H  = (byte)new Random().Next(3);

                if (ID.Equals(81) && C.GetBlock(new BlockLocation(_X, (byte)(_Y - 1), _Z, C.World)).Equals(MaterialManager.GetBlock(12)))
                {
                    //Cactus
                    WorldGeneratorUtils.GenerateTower(ID, 0, C, _X, _Y, _Z, H);
                }
            }
        }
Пример #3
0
 public static void GenerateSphere(short ID, byte Meta, Chunk C, int X, byte Y, int Z, byte Radius)
 {
     for (int j = Convert.ToInt16(-Radius); j <= Radius; j = (short)(j + 1))
     {
         if ((X + j) < 0 || (X + j) > 16)
         {
             continue;
         }
         for (int k = Convert.ToInt16(-Radius); k <= Radius; k = (short)(k + 1))
         {
             if ((Y + k) < 0 || (Y + k) > 255)
             {
                 continue;
             }
             for (int m = Convert.ToInt16(-Radius); m <= Radius; m = (short)(m + 1))
             {
                 if ((Z + m) < 0 || (Z + m) > 15)
                 {
                     continue;
                 }
                 int maXValue = (short)Math.Sqrt((double)(((j * j) + (k * k)) + (m * m)));
                 if ((maXValue < (Radius + 1)))
                 {
                     try
                     {
                         int X2 = X + j;
                         int Y2 = Y + k;
                         int Z2 = Z + m;
                         if (X2 <= 15 && Y2 <= 255 && Z2 <= 15)
                         {
                             if (!C.GetBlock(new BlockLocation(X + j, (byte)(Y + k), Z + m, C.World)).Equals(MaterialManager.GetBlock(7)) && !C.GetBlock(new BlockLocation(X + j, (byte)(Y + k), Z + m, C.World)).Equals(MaterialManager.GetBlock(17)))
                             {
                                 C.SetBlock(new BlockLocation(X + j, (byte)(Y + k), Z + m, C.World), MaterialManager.GetMaterial(ID), 0);
                             }
                         }
                     }
                     catch { }
                 }
             }
         }
     }
 }
Пример #4
0
        internal Block GetBlock(BlockLocation BL)
        {
            Chunk C = chunkManager.GetChunkAt(BL.chunkLocation);             //Get the chunk based off the blocks ChunkLocation variable

            return(C.GetBlock(BL));
        }