public SetBlocks(CommandsGeneratorTemplate cmdGenerator) { backColor = new SolidColorBrush(Color.FromRgb(255, 255, 255)); InitializeComponent(); UpdateItemPick(BlocksB, null); LocA.SetForeground(Color.FromRgb(255, 255, 255)); LocB.SetForeground(Color.FromRgb(255, 255, 255)); clone_loc.SetForeground(Color.FromRgb(255, 255, 255)); CmdGenerator = cmdGenerator; }
public string GenerateCommand() { int a = 0; if (a == 0) { return("等待更新"); // 当前页面仅1.13版本有效"; } if (setblock.IsChecked == true) { string s = ""; if (Meta.Value != 0) { s += " 0"; } if (setblock_method.SelectedIndex != 2) { if (s == "") { s += " 0"; } if (setblock_method.SelectedIndex == 0) { s += " destroy"; } else { s += " keep"; } } return("/setblock " + LocA.GetLocation() + " " + BlockName.Text + s); } else if (blockdata.IsChecked == true) { if (blockNBT.Text == "") { return("请填写方块NBT!"); } string nbt = blockNBT.Text; string[] nbts = nbt.Split('-'); if (nbts.Length != 3) { return("错误的方块NBT数据!"); } return("/blockdata " + LocA.GetLocation() + " " + nbts[2]); } else if (fill.IsChecked == true) { string nbt = fill_block1.Text; string[] nbts = nbt.Split('-'); if (nbts.Length != 3) { return("错误的方块NBT数据!"); } string method = "", info = ""; switch (fill_method.SelectedIndex) { case 0: method = nbts[1] + " destory"; if (nbts[2] != "{}") { method += " " + nbts[2]; } break; case 1: method = nbts[1] + " hollow"; if (nbts[2] != "{}") { method += " " + nbts[2]; } break; case 2: method = nbts[1] + " keep"; if (nbts[2] != "{}") { method += " " + nbts[2]; } break; case 3: method = nbts[1] + " outline"; if (nbts[2] != "{}") { method += " " + nbts[2]; } break; case 4: if (isReplace.IsChecked == true) { method = nbts[1] + " replace "; string[] replace = replace_NBT.Text.Split('-'); if (replace.Length != 3) { return("错误的方块NBT数据!"); } method += replace[0]; if (replace[1] != "0") { method += " " + replace[1]; } } else if (nbts[2] != "{}") { info = nbts[1] + " replace " + nbts[2]; } else if (nbts[1] != "0") { info += nbts[1]; } break; } return("/fill " + LocA.GetLocation() + " " + LocB.GetLocation() + " " + nbts[0] + " " + method + info); } else { string data = "", copy = "", clone = ""; switch (copy_method.SelectedIndex) { case 0: copy = " force"; break; case 1: copy = " move"; break; case 2: copy = " normal"; break; } switch (clone_method.SelectedIndex) { case 0: clone = " filtered"; break; case 1: clone = " masked"; break; case 2: clone = " replace"; break; } if (copy != " normal") { data = clone + copy; } else if (clone != " replace") { data = clone; } if (clone == " filtered") { if (TileName.Text == "") { return("请填写方块信息!"); } else { data = clone + copy + " " + TileName.Text.Split('-')[0]; } } return("/clone " + LocA.GetLocation() + " " + LocB.GetLocation() + " " + clone_loc.GetLocation() + data); } }