Fix new map format, to support the 4096 ids
This commit is contained in:
@@ -305,7 +305,7 @@ class RegionSet(object):
|
|||||||
* For each chunk section:
|
* For each chunk section:
|
||||||
|
|
||||||
* The "Blocks" byte string is transformed into a 16x16x16 numpy array
|
* The "Blocks" byte string is transformed into a 16x16x16 numpy array
|
||||||
* The AddBlocks array, if it exists, is bitshifted left 8 bits and
|
* The Add array, if it exists, is bitshifted left 8 bits and
|
||||||
added into the Blocks array
|
added into the Blocks array
|
||||||
* The "SkyLight" byte string is transformed into a 16x16x128 numpy
|
* The "SkyLight" byte string is transformed into a 16x16x128 numpy
|
||||||
array
|
array
|
||||||
@@ -381,11 +381,11 @@ class RegionSet(object):
|
|||||||
# Cast up to uint16, blocks can have up to 12 bits of data
|
# Cast up to uint16, blocks can have up to 12 bits of data
|
||||||
blocks = blocks.astype(numpy.uint16)
|
blocks = blocks.astype(numpy.uint16)
|
||||||
blocks = blocks.reshape((16,16,16))
|
blocks = blocks.reshape((16,16,16))
|
||||||
if "AddBlocks" in section:
|
if "Add" in section:
|
||||||
# This section has additional bits to tack on to the blocks
|
# This section has additional bits to tack on to the blocks
|
||||||
# array. AddBlocks is a packed array with 4 bits per slot, so
|
# array. Add is a packed array with 4 bits per slot, so
|
||||||
# it needs expanding
|
# it needs expanding
|
||||||
additional = numpy.frombuffer(section['AddBlocks'], dtype=numpy.uint8)
|
additional = numpy.frombuffer(section['Add'], dtype=numpy.uint8)
|
||||||
additional = additional.astype(numpy.uint16).reshape((16,16,8))
|
additional = additional.astype(numpy.uint16).reshape((16,16,8))
|
||||||
additional_expanded = numpy.empty((16,16,16), dtype=numpy.uint16)
|
additional_expanded = numpy.empty((16,16,16), dtype=numpy.uint16)
|
||||||
additional_expanded[:,:,::2] = (additional & 0x0F) << 8
|
additional_expanded[:,:,::2] = (additional & 0x0F) << 8
|
||||||
@@ -393,7 +393,7 @@ class RegionSet(object):
|
|||||||
blocks += additional_expanded
|
blocks += additional_expanded
|
||||||
del additional
|
del additional
|
||||||
del additional_expanded
|
del additional_expanded
|
||||||
del section['AddBlocks'] # Save some memory
|
del section['Add'] # Save some memory
|
||||||
section['Blocks'] = blocks
|
section['Blocks'] = blocks
|
||||||
|
|
||||||
# Turn the skylight array into a 16x16x16 matrix. The array comes
|
# Turn the skylight array into a 16x16x16 matrix. The array comes
|
||||||
|
|||||||
Reference in New Issue
Block a user