Skip to content

Commit

Permalink
Add support for NBT TAG_Long_Array
Browse files Browse the repository at this point in the history
  • Loading branch information
Ekdohibs committed Aug 29, 2019
1 parent 9f0bd09 commit b6f6e92
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions nbt.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand All @@ -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 = {}
Expand Down

0 comments on commit b6f6e92

Please sign in to comment.