Ejemplo n.º 1
0
        public override void Decorate(Chunk C, int X, byte Y, int Z)
        {
            //TODO: Create a better Ore Decorator
            int  _X = X;
            byte _Y = Y;
            int  _Z = Z;

            for (int I = 0; I <= R.Next(VeinSize); I++)
            {
                if (R.NextDouble() > 0.5)
                {
                    if (!I.Equals(0))
                    {
                        double Random = R.NextDouble();
                        if (0.0 <= Random && Random <= 0.3 && _X - X < 2)
                        {
                            _X += 1;
                        }
                        else if (0.4 <= Random && Random <= 0.6 && _Y - Y < 2)
                        {
                            _Y += 1;
                        }
                        else if (0.7 <= Random && Random <= 1.0 && _Z - Z < 2)
                        {
                            _Z += 1;
                        }
                    }

                    if (C.GetBlock(new BlockLocation(_X, _Y, _Z, C.World)).Equals(MaterialManager.GetBlock(1)))
                    {
                        C.SetBlock(new BlockLocation(_X, _Y, _Z, C.World), MaterialManager.GetMaterial(ID), 0);
                    }
                }
            }
        }
Ejemplo n.º 2
0
 public static void GenerateTower(short ID, byte Meta, Chunk C, int X, byte Y, int Z, byte Height)
 {
     for (int I = Y; I < Y + Height; I++)
     {
         C.SetBlock(new BlockLocation(X, (byte)I, Z, C.World), MaterialManager.GetMaterial(ID), Meta);
     }
 }
Ejemplo n.º 3
0
        internal void SetBlock(BlockLocation BL, Material mat, byte meta = 0)
        {
            Chunk C = chunkManager.GetChunkAt(BL.chunkLocation);             //Get the chunk based off the blocks ChunkLocation variable

            C.SetBlock(BL, mat, meta);

            foreach (Player p in chunkManager.GetVisiblePlayers(C.CL.regionLocation))
            {
                p.client.SendBlockChange(BL, mat, meta);
            }
            //TODO MetaData
        }
Ejemplo n.º 4
0
 public static void GenerateHalfCircle(short ID, byte Meta, Chunk C, int X, byte Y, int Z, byte Radius)
 {
     for (int x = X - Radius; x <= X + Radius; x++)
     {
         for (int y = Y - Radius; y <= Y + Radius; y++)
         {
             if (new BlockLocation(X, Y, Z, C.World).GetDistance(new BlockLocation(x, (byte)y, Z, C.World)) <= Radius)
             {
                 C.SetBlock(new BlockLocation(x, (byte)y, Z, C.World), MaterialManager.GetMaterial(ID), Meta);
             }
         }
     }
 }
Ejemplo n.º 5
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);
                }
            }
        }
Ejemplo n.º 6
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 { }
                 }
             }
         }
     }
 }
Ejemplo n.º 7
0
        public override void Decorate(Chunk C)
        {
            for (int y = 0; y < 256; y++)
            {
                for (int z = 0; z < 16; z++)
                {
                    for (int x = 0; x < 16; x++)
                    {
                        if (y > 30)
                        {
                            if (y <= 38)
                            {
                                if (4 < x && x < 14 && z.Equals(5) || 4 < x && x < 14 && z.Equals(13) || 4 < z && z < 14 && x.Equals(5) || 4 < z && z < 14 && x.Equals(13))
                                {
                                    C.SetBlock(new BlockLocation(x, (byte)y, z, C.World), MaterialManager.GetMaterial(98), 0);
                                }

                                if (y.Equals(34))
                                {
                                    if (5 < x && x < 13 && 5 < z && z < 13)
                                    {
                                        C.SetBlock(new BlockLocation(x, (byte)y, z, C.World), MaterialManager.GetMaterial(5), 0);
                                    }
                                }
                                if (x.Equals(5) && z.Equals(9) && y < 33)
                                {
                                    C.SetBlock(new BlockLocation(x, (byte)y, z, C.World), MaterialManager.GetMaterial(0), 0);
                                }

                                if (x.Equals(5) && 5 < z && z < 8 && 35 < y && y < 38 || x.Equals(5) && 10 < z && z < 13 && 35 < y && y < 38)
                                {
                                    C.SetBlock(new BlockLocation(x, (byte)y, z, C.World), MaterialManager.GetMaterial(20), 0);
                                }

                                if (x.Equals(6) && z.Equals(12))
                                {
                                    if (y < 36)
                                    {
                                        C.SetBlock(new BlockLocation(x, (byte)y, z, C.World), MaterialManager.GetMaterial(65), 0);
                                    }
                                }
                            }
                            else if (y.Equals(39))
                            {
                                if (3 < x && x < 15 && 3 < z && z < 15)
                                {
                                    C.SetBlock(new BlockLocation(x, (byte)y, z, C.World), MaterialManager.GetMaterial(17), 0);
                                }
                            }
                            else if (y.Equals(40))
                            {
                                if (4 < x && x < 14 && 4 < z && z < 14)
                                {
                                    C.SetBlock(new BlockLocation(x, (byte)y, z, C.World), MaterialManager.GetMaterial(17), 0);
                                }
                            }
                            else if (y.Equals(41))
                            {
                                if (5 < x && x < 13 && 5 < z && z < 13)
                                {
                                    C.SetBlock(new BlockLocation(x, (byte)y, z, C.World), MaterialManager.GetMaterial(17), 0);
                                }
                            }
                            else if (y.Equals(42))
                            {
                                if (6 < x && x < 12 && 6 < z && z < 12)
                                {
                                    C.SetBlock(new BlockLocation(x, (byte)y, z, C.World), MaterialManager.GetMaterial(17), 0);
                                }
                            }
                        }
                    }
                }
            }
        }