Add support for NBT TAG_Long_Array

master
Ekdohibs 2019-08-29 11:33:16 +02:00
parent 9f0bd09dd1
commit b6f6e928d5
1 changed files with 7 additions and 0 deletions

7
nbt.py
View File

@ -17,6 +17,11 @@ def _read_tag(bytes, index, tag):
value = list(struct.unpack(">"+str(plen)+"i", bytes[index:index+4*plen]))
index += 4*plen
return value, index
elif tag == 12:
plen, index = _read_tag(bytes, index, 3)
value = list(struct.unpack(">"+str(plen)+"q", bytes[index:index+8*plen]))
index += 8*plen
return value, index
elif tag == 8:
plen, index = _read_tag(bytes, index, 2)
value = bytes[index:index+plen].decode('utf-8')
@ -33,6 +38,8 @@ def _read_tag(bytes, index, tag):
return value, index
elif tag == 10:
return _read_named(bytes, index)
else:
raise Exception("Unknown tag: " + str(tag))
def _read_named(bytes, index):
d = {}