Added pynbt in order to decompress and read nbt data into a more friendly format

This commit is contained in:
Ammar Askar committed 2012-11-03 19:08:39 +05:00
1 parent 5cd8554908
commit 7d50e325ba
5 files changed
+382 -2

No files matched your search

+4 -1
View File
@@ -1,5 +1,7 @@
import struct
import types
from io import BytesIO
from pynbt import NBTFile
def readBoolean(FileObject):
return struct.unpack('?', FileObject.read(1))[0]
@@ -104,10 +106,11 @@ def readSlotData(FileObject):
MetadataLength = readShort(FileObject)
if(MetadataLength != -1):
ByteArray = readByteArray(FileObject, MetadataLength)
NBTData = NBTFile(BytesIO(ByteArray), compression=NBTFile.Compression.GZIP)
return {'BlockID' : BlockID,
'ItemCount' : ItemCount,
'Damage' : Damage,
'Data' : ByteArray
'Data' : NBTData
}
return {'BlockID' : BlockID,
'ItemCount' : ItemCount,