0

added int array support to nbt.py

(untested) Also removed an extra import that I forgot about earlier.
This commit is contained in:
Andrew Brown
2012-02-15 18:20:57 -05:00
parent 0b7e42110c
commit 6b449da966
2 changed files with 6 additions and 1 deletions

View File

@@ -85,6 +85,7 @@ class NBTFileReader(object):
8: self._read_tag_string, 8: self._read_tag_string,
9: self._read_tag_list, 9: self._read_tag_list,
10:self._read_tag_compound, 10:self._read_tag_compound,
11:self._read_tag_int_array,
} }
# These private methods read the payload only of the following types # These private methods read the payload only of the following types
@@ -121,6 +122,11 @@ class NBTFileReader(object):
bytes = self._file.read(length) bytes = self._file.read(length)
return bytes return bytes
def _read_tag_int_array(self):
length = self._read_tag_int()
int_bytes = self._file.read(length*4)
return struct.unpack(">%ii" % length, int_bytes)
def _read_tag_string(self): def _read_tag_string(self):
length = self._read_tag_short() length = self._read_tag_short()
# Read the string # Read the string

View File

@@ -5,7 +5,6 @@ from collections import namedtuple
import rendermodes import rendermodes
from world import UPPER_LEFT, UPPER_RIGHT, LOWER_LEFT, LOWER_RIGHT from world import UPPER_LEFT, UPPER_RIGHT, LOWER_LEFT, LOWER_RIGHT
import logging
class ValidationException(Exception): class ValidationException(Exception):
pass pass