fixed rotated renders for anvil-formatted worlds
This commit is contained in:
@@ -45,7 +45,7 @@ def checkBadEscape(s):
|
|||||||
|
|
||||||
def validateWorldPath(worldpath):
|
def validateWorldPath(worldpath):
|
||||||
_, worldpath = checkBadEscape(worldpath)
|
_, worldpath = checkBadEscape(worldpath)
|
||||||
abs_path = os.path.abspath(worldpath)
|
abs_path = os.path.abspath(os.path.expanduser(worldpath))
|
||||||
if not os.path.exists(os.path.join(abs_path, "level.dat")):
|
if not os.path.exists(os.path.join(abs_path, "level.dat")):
|
||||||
raise ValidationException("No level.dat file in '%s'. Are you sure you have the right path?" % (abs_path,))
|
raise ValidationException("No level.dat file in '%s'. Are you sure you have the right path?" % (abs_path,))
|
||||||
return abs_path
|
return abs_path
|
||||||
|
|||||||
@@ -465,10 +465,16 @@ class RotatedRegionSet(RegionSet):
|
|||||||
def get_chunk(self, x, z):
|
def get_chunk(self, x, z):
|
||||||
x,z = self.unrotate(x,z)
|
x,z = self.unrotate(x,z)
|
||||||
chunk_data = super(RotatedRegionSet, self).get_chunk(x,z)
|
chunk_data = super(RotatedRegionSet, self).get_chunk(x,z)
|
||||||
chunk_data['Blocks'] = numpy.rot90(chunk_data['Blocks'], self.north_dir)
|
for section in chunk_data['Sections']:
|
||||||
chunk_data['Data'] = numpy.rot90(chunk_data['Data'], self.north_dir)
|
for arrayname in ['Blocks', 'Data', 'SkyLight', 'BlockLight']:
|
||||||
chunk_data['SkyLight'] = numpy.rot90(chunk_data['SkyLight'], self.north_dir)
|
array = section[arrayname]
|
||||||
chunk_data['BlockLight'] = numpy.rot90(chunk_data['BlockLight'], self.north_dir)
|
# New arrays are arranged with axes Y,Z,X
|
||||||
|
# numpy.rot90 always rotates the first two axes, so for it to
|
||||||
|
# work, we need to temporarily more the X axis to the 0th axis.
|
||||||
|
array = numpy.swapaxes(array, 0,2)
|
||||||
|
array = numpy.rot90(array, self.north_dir)
|
||||||
|
array = numpy.swapaxes(array, 0,2)
|
||||||
|
section[arrayname] = array
|
||||||
return chunk_data
|
return chunk_data
|
||||||
|
|
||||||
def get_chunk_mtime(self, x, z):
|
def get_chunk_mtime(self, x, z):
|
||||||
|
|||||||
Reference in New Issue
Block a user