예제 #1
0
        public bool InsertTag(TagNode tag, int index)
        {
            if (index < 0 || index > _tag.Count)
            {
                return(false);
            }

            _tag.Insert(index, tag);
            return(true);
        }
예제 #2
0
        public bool InsertTag(TagNode tag, int index)
        {
            if (index < 0 || index > _tag.Count)
            {
                return(false);
            }

            if (_tag.ValueType != tag.GetTagType())
            {
                return(false);
            }

            _tag.Insert(index, tag);

            SetModified();
            return(true);
        }
예제 #3
0
    public static void SaveData(TagNodeList Inventory)
    {
        Inventory.Clear();
        Inventory.ChangeValueType(TagType.TAG_COMPOUND);

        int count = 0;

        for (int i = 0; i < 36; i++)
        {
            InventoryItem item = items[i];
            if (item.id != null)
            {
                TagNodeCompound serializeItem = new TagNodeCompound();
                serializeItem.Add("Count", (TagNodeByte)item.count);
                serializeItem.Add("Damage", (TagNodeShort)item.damage);
                serializeItem.Add("id", (TagNodeString)item.id);
                serializeItem.Add("Slot", (TagNodeByte)i);
                Inventory.Insert(count, serializeItem);
            }
        }
    }