Esempio n. 1
0
        private void WriteNbtTag (StreamWriter writer, TagNode tag)
        {
            if (tag == null)
                return;

            writer.Write(JSONSerializer.Serialize(tag));
        }
        public static string GetTagNodeText(TagNode tag)
        {
            if (tag == null)
                return null;

            switch (tag.GetTagType())
            {
                case TagType.TAG_BYTE:
                case TagType.TAG_SHORT:
                case TagType.TAG_INT:
                case TagType.TAG_LONG:
                case TagType.TAG_FLOAT:
                case TagType.TAG_DOUBLE:
                case TagType.TAG_STRING:
                    return tag.ToString();

                case TagType.TAG_BYTE_ARRAY:
                    return tag.ToTagByteArray().Length + " bytes";

                case TagType.TAG_LIST:
                    return tag.ToTagList().Count + " entries";

                case TagType.TAG_COMPOUND:
                    return tag.ToTagCompound().Count + " entries";
            }

            return null;
        }
Esempio n. 3
0
        public bool DeleteTag(TagNode tag)
        {
            foreach (String name in _tag.Keys)
                if (_tag[name] == tag)
                    return _tag.Remove(name);

            return false;
        }
Esempio n. 4
0
        public bool AddTag(TagNode tag, string name)
        {
            if (_tag.ContainsKey(name))
                return false;

            _tag.Add(name, tag);
            return true;
        }
Esempio n. 5
0
        public bool DeleteTag (TagNode tag)
        {
            bool result = _tag.Remove(tag);
            if (result)
                SetModified();

            return result;
        }
Esempio n. 6
0
        public bool InsertTag(TagNode tag, int index)
        {
            if (index < 0 || index > _tag.Count)
                return false;

            _tag.Insert(index, tag);
            return true;
        }
Esempio n. 7
0
        public string GetTagName(TagNode tag)
        {
            foreach (String name in _tag.Keys)
                if (_tag[name] == tag)
                    return name;

            return null;
        }
Esempio n. 8
0
        public override TypedEntity LoadTree(TagNode tree)
        {
            TagNodeCompound ctree = tree as TagNodeCompound;
            if (ctree == null || base.LoadTree(tree) == null) {
                return null;
            }

            return this;
        }
Esempio n. 9
0
        public bool AppendTag (TagNode tag)
        {
            if (_tag.ValueType != tag.GetTagType())
                return false;

            _tag.Add(tag);

            SetModified();
            return true;
        }
Esempio n. 10
0
        private void Apply()
        {
            if (ValidateInput()) {
                _tag = CreateTag();

                DialogResult = DialogResult.OK;
                Close();
                return;
            }
        }
Esempio n. 11
0
        public override TypedEntity LoadTree(TagNode tree)
        {
            TagNodeCompound ctree = tree as TagNodeCompound;
            if (ctree == null || base.LoadTree(tree) == null) {
                return null;
            }

            _tile = ctree["Tile"].ToTagByte();

            return this;
        }
Esempio n. 12
0
        public override TileEntity LoadTree(TagNode tree)
        {
            TagNodeCompound ctree = tree as TagNodeCompound;
            if (ctree == null || base.LoadTree(tree) == null) {
                return null;
            }

            _command = ctree["Command"].ToTagString();

            return this;
        }
Esempio n. 13
0
        public override TypedEntity LoadTree (TagNode tree)
        {
            TagNodeCompound ctree = tree as TagNodeCompound;
            if (ctree == null || base.LoadTree(tree) == null) {
                return null;
            }

            _profession = ctree["Profession"].ToTagInt();

            return this;
        }
Esempio n. 14
0
        public override EntityTyped LoadTree(TagNode tree)
        {
            TagNodeCompound ctree = tree as TagNodeCompound;
            if (ctree == null || base.LoadTree(tree) == null) {
                return null;
            }

            _size = ctree["Size"].ToTagInt();

            return this;
        }
Esempio n. 15
0
        public bool RenameTag(TagNode tag, string name)
        {
            if (_tag.ContainsKey(name))
                return false;

            string oldName = GetTagName(tag);
            _tag.Remove(oldName);
            _tag.Add(name, tag);

            return true;
        }
Esempio n. 16
0
        public override TypedEntity LoadTree(TagNode tree)
        {
            TagNodeCompound ctree = tree as TagNodeCompound;
            if (ctree == null || base.LoadTree(tree) == null) {
                return null;
            }

            _anger = ctree["Anger"].ToTagShort();

            return this;
        }
Esempio n. 17
0
        public override EntityTyped LoadTree(TagNode tree)
        {
            TagNodeCompound ctree = tree as TagNodeCompound;
            if (ctree == null || base.LoadTree(tree) == null) {
                return null;
            }

            _saddle = ctree["Saddle"].ToTagByte() == 1;

            return this;
        }
        public override TypedEntity LoadTree(TagNode tree)
        {
            TagNodeCompound ctree = tree as TagNodeCompound;
            if (ctree == null || base.LoadTree(tree) == null)
            {
                return null;
            }

            _eggTime = ctree["EggLayTime"].ToTagInt();

            return this;
        }
        public override TypedEntity LoadTree (TagNode tree)
        {
            TagNodeCompound ctree = tree as TagNodeCompound;
            if (ctree == null || base.LoadTree(tree) == null) {
                return null;
            }
            
            _type = ctree["RabbitType"].ToTagByte();
            _carrots = ctree["MoreCarrotTicks"].ToTagByte();

            return this;
        }
Esempio n. 20
0
 internal static ItemInfo TryGetItemName(TagNode tag)
 {
     var tagc = tag as TagNodeCompound;
     if (tagc.ContainsKey("id") == false)
         return null;
         int id;
         if (int.TryParse(tagc["id"].ToString(), out id))
         {
             return TryGetItemName(id);
         }
         return null;
 }
Esempio n. 21
0
        public override TileEntity LoadTree(TagNode tree)
        {
            TagNodeCompound ctree = tree as TagNodeCompound;
            if (ctree == null || base.LoadTree(tree) == null) {
                return null;
            }

            TagNodeList items = ctree["Items"].ToTagList();
            _items = new ItemCollection(_CAPACITY).LoadTree(items);

            return this;
        }
        public override TypedEntity LoadTree (TagNode tree)
        {
            TagNodeCompound ctree = tree as TagNodeCompound;
            if (ctree == null || base.LoadTree(tree) == null) {
                return null;
            }

            TagNodeList items = ctree["Items"].ToTagList();
            _items = _items.LoadTree(items);

            return this;
        }
        public override TileEntity LoadTree(TagNode tree)
        {
            TagNodeCompound ctree = tree as TagNodeCompound;
            if (ctree == null || base.LoadTree(tree) == null) {
                return null;
            }

            _delay = ctree["Delay"].ToTagShort();
            _entityID = ctree["EntityId"].ToTagString();

            return this;
        }
        public override TypedEntity LoadTree (TagNode tree)
        {
            TagNodeCompound ctree = tree as TagNodeCompound;
            if (ctree == null || base.LoadTree(tree) == null) {
                return null;
            }

            _carried = ctree["carried"].ToTagShort();
            _carryingData = ctree["carriedData"].ToTagShort();

            return this;
        }
Esempio n. 25
0
        public override TypedEntity LoadTree(TagNode tree)
        {
            TagNodeCompound ctree = tree as TagNodeCompound;
            if (ctree == null || base.LoadTree(tree) == null) {
                return null;
            }

            _inData = ctree["inData"].ToTagByte();
            _player = ctree["player"].ToTagByte();

            return this;
        }
Esempio n. 26
0
        public override TypedEntity LoadTree (TagNode tree)
        {
            TagNodeCompound ctree = tree as TagNodeCompound;
            if (ctree == null || base.LoadTree(tree) == null) {
                return null;
            }

            _sheared = ctree["Sheared"].ToTagByte() == 1;
            _color = ctree["Color"].ToTagByte();

            return this;
        }
        public override TypedEntity LoadTree (TagNode tree)
        {
            TagNodeCompound ctree = tree as TagNodeCompound;
            if (ctree == null || base.LoadTree(tree) == null) {
                return null;
            }

            _life = ctree["Lifetime"].ToTagInt();
            _player = ctree["PlayerSpawned"].ToTagByte() == 1;

            return this;
        }
Esempio n. 28
0
        public override TypedEntity LoadTree(TagNode tree)
        {
            TagNodeCompound ctree = tree as TagNodeCompound;
            if (ctree == null || base.LoadTree(tree) == null) {
                return null;
            }

            _age = ctree["Age"].ToTagInt();
            _inLove = ctree["InLove"].ToTagInt();

            return this;
        }
        public override TileEntity LoadTree(TagNode tree)
        {
            TagNodeCompound ctree = tree as TagNodeCompound;
            if (ctree == null || base.LoadTree(tree) == null) {
                return null;
            }

            if (ctree.ContainsKey("Record")) {
                _record = ctree["Record"].ToTagInt();
            }

            return this;
        }
Esempio n. 30
0
        public override TypedEntity LoadTree (TagNode tree)
        {
            TagNodeCompound ctree = tree as TagNodeCompound;
            if (ctree == null || base.LoadTree(tree) == null) {
                return null;
            }

            _owner = ctree["Owner"].ToTagString();
            _sitting = ctree["Sitting"].ToTagByte() == 1;
            _angry = ctree["Angry"].ToTagByte() == 1;

            return this;
        }
Esempio n. 31
0
 public override bool ValidateTree(TagNode tree)
 {
     return(new NbtVerifier(tree, MonsterSchema).Verify());
 }
Esempio n. 32
0
 public TagScalarFormData(TagNode tag)
 {
     Tag = tag;
 }
Esempio n. 33
0
 protected Container(TagNode tag)
     : base(tag)
 {
 }
Esempio n. 34
0
 protected TagDataNode(TagNode tag)
 {
     _tag = tag;
 }
Esempio n. 35
0
 public virtual bool DeleteTag(TagNode tag)
 {
     return(false);
 }
Esempio n. 36
0
 /// <inheritdoc/>
 public bool ValidateTree(TagNode tree)
 {
     return(new NbtVerifier(tree, _schema).Verify());
 }