public void Write(TagType type, bool allowEndTag = false) { if (!type.IsValid(allowEndTag)) { throw new ArgumentException(string.Format( "Invalid NBT tag type 0x{0:X}", type), "type"); } Write((byte)type); }
/// <summary> /// Creates an empty / default value tag from a given tag type. /// </summary> public static TagBase CreateTagFromType(TagType type) { if (!type.IsValid()) { throw new ArgumentException(string.Format( "Invalid NBT tag type 0x{0:X}", type), "type"); } return(_constructorLookup[(byte)type - 1]()); }
/// <summary> /// Reads an NBT tag of a given tag type and its name. /// </summary> public TagBase ReadTag(TagType type, out string name) { if (!type.IsValid()) { throw new ArgumentException(string.Format( "Invalid NBT tag type 0x{0:X}", type), "type"); } name = ReadString(); return(ReadTag(type)); }