Types
TagDataTooLarge = object of TagParsingError
- Source Edit
TagNode {.acyclic.} = ref object case kind*: TagNodeKind of End: nil of Byte: byteVal*: int8 of Short: shortVal*: int16 of Int: intVal*: int32 of Long: longVal*: int64 of Float: floatVal*: float32 of Double: doubleVal*: float64 of ByteArray: byteArrVal*: seq[int8] of String: strVal*: string of List: typ*: TagNodeKind listVal*: seq[TagNode] of Compound: compoundVal*: Table[string, TagNode] of IntArray: intArrVal*: seq[int32] of LongArray: longArrVal*: seq[int64]
- NBT node type Source Edit
TagNodeKind = enum End = 0, Byte = 1, Short = 2, Int = 3, Long = 4, Float = 5, Double = 6, ByteArray = 7, String = 8, List = 9, Compound = 10, IntArray = 11, LongArray = 12
- NBT tags Source Edit
TagParsingError = object of ValueError
- Source Edit
TagValidationError = object of ValueError
- Source Edit
Procs
proc dumpNbt(s: TagNode; format = BE; network = true): string {. ...raises: [IOError, OSError, TagValidationError], tags: [WriteIOEffect, ReadIOEffect], forbids: [].}
-
Writes an NBT tag to a string.
format specifies the endianness of the data network specifies whether the data is sent over the network
Source Edit func getByteArray(node: TagNode): seq[int8] {....raises: [TagValidationError], tags: [], forbids: [].}
- Get the byte array value of a byte array TagNode Source Edit
func getIntArray(node: TagNode): seq[int32] {....raises: [TagValidationError], tags: [], forbids: [].}
- Get the int array value of an int array TagNode Source Edit
func getLongArray(node: TagNode): seq[int64] {....raises: [TagValidationError], tags: [], forbids: [].}
- Get the long array value of a long array TagNode Source Edit
func newTagByte(x: int8): TagNode {....raises: [], tags: [], forbids: [].}
- Returns a byte TagNode with a signed byte as the value. Source Edit
func newTagByteArray(x = newSeq()): TagNode {....raises: [], tags: [], forbids: [].}
- Returns a byte array TagNode with a seqint8 as the value. Source Edit
func newTagCompound(x = initTable()): TagNode {....raises: [], tags: [], forbids: [].}
- Returns a compound TagNode with a Tablestring, TagNode as the value. Source Edit
func newTagDouble(x: float64): TagNode {....raises: [], tags: [], forbids: [].}
- Returns a double TagNode with a double as the value. Source Edit
func newTagFloat(x: float32): TagNode {....raises: [], tags: [], forbids: [].}
- Returns a float TagNode with a float as the value. Source Edit
func newTagIntArray(x = newSeq()): TagNode {....raises: [], tags: [], forbids: [].}
- Returns an int array TagNode with a seqint32 as the value. Source Edit
func newTagList(typ: TagNodeKind; x = newSeq()): TagNode {. ...raises: [TagValidationError], tags: [], forbids: [].}
- Returns a list TagNode with a seqTagNode as the value. Source Edit
func newTagLong(x: int64): TagNode {....raises: [], tags: [], forbids: [].}
- Returns a long TagNode with a signed long as the value. Source Edit
func newTagLongArray(x = newSeq()): TagNode {....raises: [], tags: [], forbids: [].}
- Returns a long array TagNode with a seqint64 as the value. Source Edit
func newTagShort(x: int16): TagNode {....raises: [], tags: [], forbids: [].}
- Returns a short TagNode with a signed short as the value. Source Edit
func newTagString(x = ""): TagNode {....raises: [], tags: [], forbids: [].}
- Returns a string TagNode with a string as the value. Source Edit
proc parseNbt(s: string; format = BE; network = false): TagNode {....raises: [ TagValidationError, OSError, IOError, ModifiedUnicodeDecodeError, Exception], tags: [ReadIOEffect, RootEffect], forbids: [].}
-
Parses NBT data structure from the string s
format specifies the endianness of the data network specifies whether the data is sent over the network
Source Edit