From 992f737984f53f26720829ccae61c99cb1ad3708 Mon Sep 17 00:00:00 2001 From: Aaron Griffith Date: Sat, 7 Jan 2012 20:23:39 -0500 Subject: [PATCH] fixed import loop and incorrect blockdata expansion --- overviewer_core/__init__.py | 5 +++++ overviewer_core/world.py | 13 ++++++------- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/overviewer_core/__init__.py b/overviewer_core/__init__.py index e69de29..e191169 100644 --- a/overviewer_core/__init__.py +++ b/overviewer_core/__init__.py @@ -0,0 +1,5 @@ +# c_overviewer must be imported first, because it imports other +# modules; leaving this out can lead to bad dependency loops + +import c_overviewer + diff --git a/overviewer_core/world.py b/overviewer_core/world.py index ebe6485..0677b68 100644 --- a/overviewer_core/world.py +++ b/overviewer_core/world.py @@ -238,8 +238,6 @@ but may be several per invocation of the Overviewer in the case of multi-world. level = data[1]['Level'] chunk_data = level chunk_data['Blocks'] = numpy.frombuffer(level['Blocks'], dtype=numpy.uint8).reshape((16,16,128)) - chunk_data['Data'] = numpy.frombuffer(level['Data'], dtype=numpy.uint8).reshape((16,16,64)) - skylight = numpy.frombuffer(level['SkyLight'], dtype=numpy.uint8).reshape((16,16,64)) @@ -258,11 +256,12 @@ but may be several per invocation of the Overviewer in the case of multi-world. blocklight_expanded[:,:,1::2] = (blocklight & 0xF0) >> 4 chunk_data['BlockLight'] = blocklight_expanded - #chunk_data = {} - #chunk_data['skylight'] = chunk.get_skylight_array(level) - #chunk_data['blocklight'] = chunk.get_blocklight_array(level) - #chunk_data['blockarray'] = chunk.get_blockdata_array(level) - #chunk_data['TileEntities'] = chunk.get_tileentity_data(level) + # expand just like skylight + blockdata = numpy.frombuffer(level['Data'], dtype=numpy.uint8).reshape((16,16,64)) + blockdata_expanded = numpy.empty((16,16,128), dtype=numpy.uint8) + blockdata_expanded[:,:,::2] = blockdata & 0x0F + blockdata_expanded[:,:,1::2] = (blockdata & 0xF0) >> 4 + chunk_data['Data'] = blockdata_expanded return chunk_data