Exemplo n.º 1
0
        private void createBtn_Click(object sender, RoutedEventArgs e)
        {
            if (tabBannerFacing.SelectedIndex < 0)
            {
                tabBannerFacing.SelectedIndex = 0;
            }
            if (tabBannerBaseColor.SelectedIndex < 0)
            {
                tabBannerBaseColor.SelectedIndex = 0;
            }
            for (int i = 0; i < globalBannerMaxIndex; i++)
            {
                if (globalBannerType[i] < 0)
                {
                    globalBannerType[i] = 0;
                }
                if (globalBannerColor[i] < 0)
                {
                    globalBannerColor[i] = 0;
                }
            }
            if (tabBannerMaxIndex >= globalBannerMaxIndex)
            {
                tabBannerMaxIndex = globalBannerMaxIndex - 1;
            }
            string first  = "";
            string second = "";

            if (tabBannerGive.IsChecked.Value)
            {
                if (ShieldCheck.IsChecked.Value)
                {
                    first = "/give @p minecraft:shield 1 0";
                }
                else
                {
                    first = "/give @p minecraft:banner 1 " + tabBannerBaseColor.SelectedIndex;
                }
                if (tabBannerHasMoreAttr.IsChecked.Value)
                {
                    second = "{";
                    if (globalEnchString.Length != 0)
                    {
                        second += globalEnchString + ",";
                    }
                    if (globalNLString.Length != 0)
                    {
                        second += globalNLString + ",";
                    }
                    if (globalAttrString.Length != 0)
                    {
                        second += globalAttrString + ",";
                    }
                    if (globalHideflag.Length != 0)
                    {
                        second += globalHideflag + ",";
                    }
                    second += "BlockEntityTag:{Base:" + tabBannerBaseColor.SelectedIndex + ",Patterns:[";
                }
                else
                {
                    second = "{BlockEntityTag:{Base:" + tabBannerBaseColor.SelectedIndex + ",Patterns:[";
                }
            }
            else
            {
                first   = "/setblock ~ ~1 ~ minecraft:standing_banner " + tabBannerFacing.SelectedIndex + " replace";
                second += "{Base:" + tabBannerBaseColor.SelectedIndex + ",Patterns:[";
            }
            string third = "";

            if (tabBannerCheckCanCreate == true)
            {
                for (int i = 0; i <= tabBannerMaxIndex; i++)
                {
                    AllSelData asd = new AllSelData();
                    third = third + "{Pattern:\"" + asd.getBannerType(globalBannerType[i]) + "\",Color:" + globalBannerColor[i] + "},";
                }
                if (third.Length >= 1)
                {
                    third = third.Remove(third.Length - 1, 1);
                }
            }
            else
            {
                string temp = BannerAtLeastClickOnce;
                this.ShowMessageAsync("", temp, MessageDialogStyle.Affirmative, new MetroDialogSettings()
                {
                    AffirmativeButtonText = FloatConfirm, NegativeButtonText = FloatCancel, AnimateShow = true
                });
            }
            string end = first + " " + second + third + "]}";

            if (tabBannerGive.IsChecked.Value)
            {
                end += "}";
            }
            finalStr = end;
            if (tabBannerShow.IsChecked.Value)
            {
                tabBannerPicCreater();
            }
        }