예제 #1
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);
             }
         }
     }
 }
예제 #2
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);
                }
            }
        }
예제 #3
0
        internal Server()         //This method HAS to return to start the GUI, do not put any loops on this thread!
        {
            Console.Title         = "DragonSpire Version " + Assembly.GetEntryAssembly().GetName().Version;
            CryptoServiceProvider = new RSACryptoServiceProvider(1024);
            ServerKey             = CryptoServiceProvider.ExportParameters(true);

            MaterialManager.LoadMaterials();
            CommandManager.LoadCommands();

            MainWorld = new World("Main", WorldGeneratorType.Flat);

            TickTimer.Initialize();                                 //The main tick loop!
            new Thread(ClientConnectionHandler.Initialize).Start(); //The Client Connection handler!
            //new Thread(PlayerPOSLoop).Start();

            Log("Server Startup Executed Succesfully.", LogTypesEnum.System);
        }
예제 #4
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);
                                }
                            }
                        }
                    }
                }
            }
        }
예제 #5
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);
                }
            }
        }
예제 #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 { }
                 }
             }
         }
     }
 }