示例#1
0
        private void passenger_entity_btn_Click(object sender, EventArgs e)
        {
            Button        this_obj      = sender as Button;
            EntityNBTForm entityNBTForm = new EntityNBTForm(this_obj.Tag != null?this_obj.Tag.ToString():"");

            entityNBTForm.Text = "设置骑乘实体信息";
            if (entityNBTForm.ShowDialog() == DialogResult.OK)
            {
                this_obj.Tag = entityNBTForm.nbt_result;
            }
        }
示例#2
0
        /// <summary>
        /// 设置或查看特殊NBT
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void set_check_special_nbt_Click(object sender, EventArgs e)
        {
            Button this_obj = sender as Button;

            if (entity_id.FindString(entity_id.Text) != entity_id.FindString(HistoryId))
            {
                this_obj.Tag = null;
                HistoryNBT   = "";
            }

            if (this_obj.Tag == null)
            {
                if (entity_id.FindString(entity_id.Text, -1) != -1)
                {
                    //引用并遍历实体NBT数据对象
                    foreach (TreeNode entites in Cbhk_form.EntityNBTs.Nodes)
                    {
                        if (entites.Text == "entities")
                        {
                            //遍历实体
                            foreach (TreeNode entity in entites.Nodes)
                            {
                                if (entity.Nodes[2].Text.Split(':')[1].Trim() == entity_id.Text.Trim())
                                {
                                    //递归收集所有NBT数据
                                    RecursionGetNBT(entity.Nodes[0].Nodes[0]);
                                    HistoryNBT   = HistoryNBT.Trim(',');
                                    this_obj.Tag = HistoryNBT;
                                    HistoryId    = entity_id.Text;
                                    break;
                                }
                            }
                        }
                    }
                }
            }

            EntityNBTForm entityNBTForm = new EntityNBTForm(this_obj.Tag != null ? this_obj.Tag.ToString():"");

            if (entityNBTForm.ShowDialog() == DialogResult.OK)
            {
                this_obj.Tag = entityNBTForm.nbt_result;
            }
        }
示例#3
0
        private void LoadItem(object sender, EventArgs e)
        {
            Button this_obj = sender as Button;

            if (this_obj.Tag == null)
            {
                Item_spawner itemspawner = new Item_spawner(null, soundPlayer, true);
                if (itemspawner.ShowDialog() == DialogResult.OK)
                {
                    this_obj.Name = itemspawner.ItemIds[0];
                    this_obj.Tag  = itemspawner.ItemNBTs[0];
                }
            }
            else
            {
                EntityNBTForm entityNBTForm = new EntityNBTForm(this_obj.Tag.ToString());
                if (entityNBTForm.ShowDialog() == DialogResult.OK)
                {
                    this_obj.Tag = entityNBTForm.nbt_result;
                }
            }
        }