Ejemplo n.º 1
0
 public void SetBlockCommand(int X, int Y, int Z, string BlockId)
 {
     CommandsTxt.AppendText("setblock " + X + " " + Y + " " + Z + " " + BlockId + " replace*\r\n");
 }
Ejemplo n.º 2
0
        private void Function_Click(object sender, EventArgs e)
        {
            if (CommandsTxt.Text == "")
            {
                MessageBox.Show("请先生成指令");
                return;
            }
            #region 压缩指令
            if (MapPath.Text != "")
            {
                DirectoryInfo Myfunction = new DirectoryInfo(FunctionsPath + "\\data\\functions\\PixelPainting");
                if (!Myfunction.Exists)
                {
                    Myfunction.Create();
                }

                //if (CommandsTxt.Lines.Length <= 65536)
                //{
                FunctionsFiles = FunctionsPath + "\\data\\functions\\PixelPainting\\" + ImageName + ".mcfunction";
                FileInfo fileinfo = new FileInfo(FunctionsFiles);
                if (!fileinfo.Exists)
                {
                    fileinfo.Create().Close();
                }
                //
                byte[]     bytes     = Encoding.UTF8.GetBytes(CommandsTxt.Text.Replace('*', ' '));
                FileStream FileWay_1 = new FileStream(FunctionsFiles, FileMode.Open, FileAccess.Write, FileShare.Write);
                FileWay_1.Write(bytes, 0, bytes.Length);
                FileWay_1.Close();

                CommandsTxt.Clear();
                CommandsTxt.AppendText("往MC客户端按以下顺序手动输入指令:\r\n");
                CommandsTxt.AppendText("/reload\r\n");
                CommandsTxt.AppendText("/function PixelPainting:" + ImageName + "\r\n");
                //}

                /*              else
                 *            {
                 *                int TxtCount = 0; //标志创建.mcfunction数量
                 *                string [] Commands = new string[CommandsTxt.Lines.Length];
                 *                for (int i = 0; i < Commands.Length; i++)
                 *                {
                 *                    Commands[i] = CommandsTxt.Lines[i];
                 *                }
                 *
                 *                string result = (CommandsTxt.Lines.Length / 65536).ToString();
                 *                TxtCount = Convert.ToInt32(result.Substring(0, result.IndexOf("."))) + 1;
                 *                for (int j = 0; j < TxtCount; j++)
                 *                {
                 *                    FunctionsFiles = FunctionsPath + "\\data\\functions\\PixelPainting\\" + ImageName + "__" + j + ".mcfunction";
                 *                    FileInfo fileinfo = new FileInfo(FunctionsFiles);
                 *                    if (!fileinfo.Exists)
                 *                    {
                 *                        fileinfo.Create().Close();
                 *                    }
                 *
                 *                    byte[] bytes = Encoding.UTF8.GetBytes(CommandsTxt.Text);
                 *                    FileStream FileWay_1 = new FileStream(FunctionsFiles, FileMode.Open, FileAccess.Write, FileShare.Write);
                 *                    FileWay_1.Write(bytes, 0, bytes.Length);
                 *                    FileWay_1.Close();
                 *                }
                 *
                 *            }*/
                //using (StreamWriter WriteCommands = new StreamWriter(file_,Encoding.UTF8))
                //{
                //        WriteCommands.Write(CommandsTxt.Text.Replace('*', ' '));
                //        WriteCommands.Flush();
                //        WriteCommands.Close();
                //        file_.Close();
                //}
            }
            else
            {
                MessageBox.Show("压缩指令前请选择客户端路径");
                return;
            }
            #endregion
        }
Ejemplo n.º 3
0
 public void FillCommand(int X1, int Y1, int Z1, int X2, int Y2, int Z2, string BlockId)
 {
     CommandsTxt.AppendText("fill " + X1 + " " + Y1 + " " + Z1 + " " + X2 + " " + Y2 + " " + Z2 + " " + BlockId + " replace*\r\n");
 }