コード例 #1
0
        private static List <Line> CreateSphere(IMinecraftCommandService commandService, string[] commandArgs,
                                                Position position, List <SavedPosition> savedPositions)
        {
            ISphereOptions sphere   = new Options();
            var            location = position;

            switch (commandArgs.Length)
            {
            case 3:     // radius height(Y) block @ current position
                sphere.Radius = commandArgs[1].ToInt();
                sphere.Block  = commandArgs[2];
                break;

            case 4:     // radius height(Y) block savedposition
            case 6:     // radius height(Y) block x y z
                sphere.Radius = commandArgs[1].ToInt();
                sphere.Block  = commandArgs[2];
                location      = location.GetAbsolutePosition(commandArgs.Skip(3).Take(3), savedPositions);
                break;

            default:
                commandService.Status("\nCREATE SPHERE\n" +
                                      "create sphere radius block - current postion\n" +
                                      "create sphere radius block [named position]\n" +
                                      "create sphere raidus block x y z");
                return(new List <Line>());
            }

            sphere.Start = location.ToPoint();
            IGenerator generator = new SphereGenerator();

            return(generator.Run((Options)sphere));
        }
コード例 #2
0
        private List <Line> CreateSphere(string[] commandArgs, Position position, List <SavedPosition> savedPositions,
                                         List <Line> lines)
        {
            IGenerator     generator;
            ISphereOptions sphere = new Options();

            switch (commandArgs.Length)
            {
            // radius height block [position]
            case 3:
                sphere.Radius = commandArgs[1].ToInt();
                //sphere.Height = commandArgs[2].ToInt();
                sphere.Block = commandArgs[2];

                sphere.CenterX = position.X;
                sphere.CenterY = position.Y;
                sphere.CenterZ = position.Z;
                break;

            // radius height block position
            case 4:
                sphere.Radius = commandArgs[1].ToInt();
                //sphere.Height = commandArgs[2].ToInt();
                sphere.Block = commandArgs[2];
                var center = savedPositions.Single(a => a.Name.Equals(commandArgs[3])).Position;
                sphere.CenterX = center.X;
                sphere.CenterY = center.Y;
                sphere.CenterZ = center.Z;
                break;

            // radius height block x y z
            case 6:
                sphere.Radius = commandArgs[1].ToInt();
                //sphere.Height = commandArgs[2].ToInt();
                sphere.Block   = commandArgs[2];
                sphere.CenterX = commandArgs[3].ToInt();
                sphere.CenterY = commandArgs[4].ToInt();
                sphere.CenterZ = commandArgs[5].ToInt();
                break;

            default:
                _minecraft.Status("\ncreate sphere syntax\n" +
                                  "create sphere radius block - current postion\n" +
                                  "create sphere radius block [named position]\n" +
                                  "create sphere raidus block x y z");
                return(new List <Line>());

                break;
            }
            generator = new SphereGenerator();
            lines     = generator.Run((Options)sphere);
            return(lines);
        }
コード例 #3
0
        private static List <Line> CreateSphere(string[] commandArgs, Position position, List <SavedPosition> savedPositions, List <Line> lines)
        {
            IGenerator     generator;
            ISphereOptions sphere = new Options();

            switch (commandArgs.Length)
            {
            // radius height block [position]
            case 3:
                sphere.Radius = commandArgs[1].ToInt();
                //sphere.Height = commandArgs[2].ToInt();
                sphere.Block = commandArgs[2];

                sphere.CenterX = position.X;
                sphere.CenterY = position.Y;
                sphere.CenterZ = position.Z;
                break;

            // radius height block position
            case 4:
                sphere.Radius = commandArgs[1].ToInt();
                //sphere.Height = commandArgs[2].ToInt();
                sphere.Block = commandArgs[2];
                var center = savedPositions.Single(a => a.Name.Equals(commandArgs[3])).Position;
                sphere.CenterX = center.X;
                sphere.CenterY = center.Y;
                sphere.CenterZ = center.Z;
                break;

            // radius height block x y z
            case 6:
                sphere.Radius = commandArgs[1].ToInt();
                //sphere.Height = commandArgs[2].ToInt();
                sphere.Block   = commandArgs[2];
                sphere.CenterX = commandArgs[3].ToInt();
                sphere.CenterY = commandArgs[4].ToInt();
                sphere.CenterZ = commandArgs[5].ToInt();
                break;
            }
            generator = new SphereGenerator();
            lines     = generator.Run((Options)sphere);
            return(lines);
        }