0

Removed biome handling and north-direction

We'll have to figure out how/where to put it back in

Rewrite Tracking Issue: #568
This commit is contained in:
Andrew Chin
2011-12-19 23:49:26 -05:00
parent 8f69da86f4
commit 119b6e1b54

View File

@@ -67,19 +67,12 @@ class World(object):
worlddir is the path to the minecraft world worlddir is the path to the minecraft world
outputdir is the output path for this render. It is used only to find the
persistent data files to read in data from last render. Also it creates
this directory if it doesn't exist.
""" """
mincol = maxcol = minrow = maxrow = 0 mincol = maxcol = minrow = maxrow = 0
### TODO clean up all of this! def __init__(self, worlddir):
def __init__(self, worlddir, outputdir, useBiomeData=False, regionlist=None, north_direction="auto"):
self.worlddir = worlddir self.worlddir = worlddir
self.outputdir = outputdir
self.useBiomeData = useBiomeData
self.north_direction = north_direction
self.regionsets = [] self.regionsets = []
@@ -116,18 +109,7 @@ class World(object):
self.name = os.path.basename(os.path.realpath(self.worlddir)) self.name = os.path.basename(os.path.realpath(self.worlddir))
# handle 'auto' north # TODO figure out where to handle regionlists
if self.north_direction == 'auto':
self.north_direction = self.persistentData['north_direction']
north_direction = self.north_direction
# If a region list was given, make sure the given paths are absolute
if regionlist:
self.regionlist = map(os.path.abspath, regionlist)
else:
self.regionlist = None
def get_level_dat_data(self): def get_level_dat_data(self):
"""Returns a dictionary representing the level.dat data for this World""" """Returns a dictionary representing the level.dat data for this World"""
@@ -169,17 +151,6 @@ class World(object):
disp_spawnX = spawnX = data['Data']['SpawnX'] disp_spawnX = spawnX = data['Data']['SpawnX']
spawnY = data['Data']['SpawnY'] spawnY = data['Data']['SpawnY']
disp_spawnZ = spawnZ = data['Data']['SpawnZ'] disp_spawnZ = spawnZ = data['Data']['SpawnZ']
if self.north_direction == 'upper-left':
temp = spawnX
spawnX = -spawnZ
spawnZ = temp
elif self.north_direction == 'upper-right':
spawnX = -spawnX
spawnZ = -spawnZ
elif self.north_direction == 'lower-right':
temp = spawnX
spawnX = spawnZ
spawnZ = -temp
## The chunk that holds the spawn location ## The chunk that holds the spawn location
chunkX = spawnX/16 chunkX = spawnX/16
@@ -195,7 +166,7 @@ class World(object):
## The filename of this chunk ## The filename of this chunk
chunkFile = self.get_region_path(chunkX, chunkY) chunkFile = self.get_region_path(chunkX, chunkY)
if chunkFile is not None: if chunkFile is not None:
data = nbt.load_from_region(chunkFile, chunkX, chunkY, self.north_direction) data = nbt.load_from_region(chunkFile, chunkX, chunkY)
if data is not None: if data is not None:
level = data[1]['Level'] level = data[1]['Level']
blockArray = numpy.frombuffer(level['Blocks'], dtype=numpy.uint8).reshape((16,16,128)) blockArray = numpy.frombuffer(level['Blocks'], dtype=numpy.uint8).reshape((16,16,128))
@@ -260,14 +231,8 @@ class World(object):
self.maxrow = maxrow self.maxrow = maxrow
def _get_north_rotations(self): def _get_north_rotations(self):
if self.north_direction == 'upper-left': # default to lower-left for now
return 1 return 0
elif self.north_direction == 'upper-right':
return 2
elif self.north_direction == 'lower-right':
return 3
elif self.north_direction == 'lower-left':
return 0