示例#1
0
        /// <summary>
        /// Reads an Uncompressed NbtBlob.
        /// </summary>
        /// <exception cref="NBTException">Invalid NbtBlob</exception>
        public static NbtBlob ReadNbtBlob(this PrimitiveReader reader)
        {
            var id = reader.ReadByte();

            if (id == Tag.EndId)
            {
                return(NbtBlob.Empty);
            }
            if (id != Tag.Compound.Id)
            {
                throw new NBTException("NBT root is not a compound.");
            }

            var name = reader.ReadStringNbt();
            var tag  = new Tag.Compound();

            tag.Read(reader, 0);
            return(new NbtBlob(name, tag));
        }
示例#2
0
 public NbtBlob(string name, Tag.Compound root)
 {
     Name = name;
     Root = root;
 }