Code cleanup to simplify upstream merge
This commit is contained in:
40
README.rst
40
README.rst
@@ -22,38 +22,6 @@ https://github.com/brownan/Minecraft-Overviewer/wiki/Documentation
|
|||||||
To contact the developers and other users, go to the site at the top of this
|
To contact the developers and other users, go to the site at the top of this
|
||||||
README, or go to #overviewer on irc.freenode.net.
|
README, or go to #overviewer on irc.freenode.net.
|
||||||
|
|
||||||
Configurable North changes
|
|
||||||
==========================
|
|
||||||
|
|
||||||
Additional Features
|
|
||||||
-------------------
|
|
||||||
|
|
||||||
A configurable north direction! I'm not a big fan of north pointing to the
|
|
||||||
bottom left corner of the screen, and I bet you aren't either. So here you go!
|
|
||||||
Either use the commandline option --north-direction, or use the option
|
|
||||||
north_direction in the settings file. Valid options are 'lower-left',
|
|
||||||
'upper-left', 'upper-right', and 'lower-right'. I'm partial to 'upper-right',
|
|
||||||
myself. Defaults to 'lower-left' to match official behavior.
|
|
||||||
|
|
||||||
Additional Bugs
|
|
||||||
---------------
|
|
||||||
|
|
||||||
Sometimes the upper- and lower-right direction seems to exacerbate an
|
|
||||||
existing bug that will not let you click on a sign in some cases. This is a
|
|
||||||
bang-head-on-desk sort of thing, I should be able to find it but I just haven't
|
|
||||||
yet. It does seem to work fine on my actual SMP map, for what that's worth.
|
|
||||||
|
|
||||||
So far only blocks where direction is important (minecart tracks, doors, signs,
|
|
||||||
etc) rotate. Blocks like grass, stone, gravel, etc do not, however for the most
|
|
||||||
part it isn't noticeable because they look very similar no matter which
|
|
||||||
direction we are viewing them from.
|
|
||||||
|
|
||||||
Upstream
|
|
||||||
--------
|
|
||||||
|
|
||||||
Once I've squashed the additional bugs and cleaned up the code a bit, I will
|
|
||||||
see about getting this included in the official Minecraft Overviewer.
|
|
||||||
|
|
||||||
Features
|
Features
|
||||||
========
|
========
|
||||||
|
|
||||||
@@ -227,6 +195,10 @@ Options
|
|||||||
--list-rendermodes
|
--list-rendermodes
|
||||||
List the available render modes, and a short description of each.
|
List the available render modes, and a short description of each.
|
||||||
|
|
||||||
|
--north-direction=NORTH_DIRECTION
|
||||||
|
Specifies which corner of the screen north will point to.
|
||||||
|
Valid options are: lower-left, upper-left, upper-right, lower-right.
|
||||||
|
|
||||||
--settings=PATH
|
--settings=PATH
|
||||||
Use this option to load settings from a file. The format of this file is
|
Use this option to load settings from a file. The format of this file is
|
||||||
given below.
|
given below.
|
||||||
@@ -296,6 +268,10 @@ textures_path
|
|||||||
source. Overviewer looks in here for terrain.png and other textures before
|
source. Overviewer looks in here for terrain.png and other textures before
|
||||||
it looks anywhere else.
|
it looks anywhere else.
|
||||||
|
|
||||||
|
north_direction
|
||||||
|
Specifies which corner of the screen north will point to.
|
||||||
|
Valid options are: lower-left, upper-left, upper-right, lower-right.
|
||||||
|
|
||||||
Viewing the Results
|
Viewing the Results
|
||||||
-------------------
|
-------------------
|
||||||
Within the output directory you will find two things: an index.html file, and a
|
Within the output directory you will find two things: an index.html file, and a
|
||||||
|
|||||||
@@ -255,7 +255,7 @@ def main():
|
|||||||
# create the quadtrees
|
# create the quadtrees
|
||||||
# TODO chunklist
|
# TODO chunklist
|
||||||
q = []
|
q = []
|
||||||
qtree_args = {'depth' : options.zoom, 'imgformat' : imgformat, 'imgquality' : options.imgquality, 'optimizeimg' : optimizeimg, 'bgcolor' : bgcolor, 'forcerender' : options.forcerender, 'north_direction' : north_direction}
|
qtree_args = {'depth' : options.zoom, 'imgformat' : imgformat, 'imgquality' : options.imgquality, 'optimizeimg' : optimizeimg, 'bgcolor' : bgcolor, 'forcerender' : options.forcerender}
|
||||||
for rendermode in options.rendermode:
|
for rendermode in options.rendermode:
|
||||||
if rendermode == 'normal':
|
if rendermode == 'normal':
|
||||||
qtree = quadtree.QuadtreeGen(w, destdir, rendermode=rendermode, tiledir='tiles', **qtree_args)
|
qtree = quadtree.QuadtreeGen(w, destdir, rendermode=rendermode, tiledir='tiles', **qtree_args)
|
||||||
|
|||||||
@@ -536,13 +536,13 @@ var overviewer = {
|
|||||||
var perPixel = 1.0 / (overviewerConfig.CONST.tileSize *
|
var perPixel = 1.0 / (overviewerConfig.CONST.tileSize *
|
||||||
Math.pow(2, overviewerConfig.map.zoomLevels));
|
Math.pow(2, overviewerConfig.map.zoomLevels));
|
||||||
|
|
||||||
if(overviewerConfig.map.north_direction == 'upper-right'){
|
if(overviewerConfig.map.north_direction == 'upper-left'){
|
||||||
x = -x-1;
|
|
||||||
y = -y-1;
|
|
||||||
} else if(overviewerConfig.map.north_direction == 'upper-left'){
|
|
||||||
temp = x;
|
temp = x;
|
||||||
x = -y-1;
|
x = -y-1;
|
||||||
y = temp;
|
y = temp;
|
||||||
|
} else if(overviewerConfig.map.north_direction == 'upper-right'){
|
||||||
|
x = -x-1;
|
||||||
|
y = -y-1;
|
||||||
} else if(overviewerConfig.map.north_direction == 'lower-right'){
|
} else if(overviewerConfig.map.north_direction == 'lower-right'){
|
||||||
temp = x;
|
temp = x;
|
||||||
x = y;
|
x = y;
|
||||||
@@ -620,13 +620,13 @@ var overviewer = {
|
|||||||
point.x += 64;
|
point.x += 64;
|
||||||
point.z -= 64;
|
point.z -= 64;
|
||||||
|
|
||||||
if(overviewerConfig.map.north_direction == 'upper-right'){
|
if(overviewerConfig.map.north_direction == 'upper-left'){
|
||||||
point.x = -point.x;
|
|
||||||
point.z = -point.z;
|
|
||||||
} else if(overviewerConfig.map.north_direction == 'upper-left'){
|
|
||||||
temp = point.z;
|
temp = point.z;
|
||||||
point.z = -point.x;
|
point.z = -point.x;
|
||||||
point.x = temp;
|
point.x = temp;
|
||||||
|
} else if(overviewerConfig.map.north_direction == 'upper-right'){
|
||||||
|
point.x = -point.x;
|
||||||
|
point.z = -point.z;
|
||||||
} else if(overviewerConfig.map.north_direction == 'lower-right'){
|
} else if(overviewerConfig.map.north_direction == 'lower-right'){
|
||||||
temp = point.z;
|
temp = point.z;
|
||||||
point.z = point.x;
|
point.z = point.x;
|
||||||
|
|||||||
@@ -210,13 +210,13 @@ class MCRFileReader(object):
|
|||||||
self._chunks = None
|
self._chunks = None
|
||||||
|
|
||||||
def get_north_rotations(self):
|
def get_north_rotations(self):
|
||||||
if self.north_direction == "upper-left":
|
if self.north_direction == 'upper-left':
|
||||||
return 1
|
return 1
|
||||||
elif self.north_direction == "upper-right":
|
elif self.north_direction == 'upper-right':
|
||||||
return 2
|
return 2
|
||||||
elif self.north_direction == "lower-right":
|
elif self.north_direction == 'lower-right':
|
||||||
return 3
|
return 3
|
||||||
elif self.north_direction == "lower-left":
|
elif self.north_direction == 'lower-left':
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
def _read_24bit_int(self):
|
def _read_24bit_int(self):
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ def iterate_base4(d):
|
|||||||
return itertools.product(xrange(4), repeat=d)
|
return itertools.product(xrange(4), repeat=d)
|
||||||
|
|
||||||
class QuadtreeGen(object):
|
class QuadtreeGen(object):
|
||||||
def __init__(self, worldobj, destdir, bgcolor, depth=None, tiledir=None, forcerender=False, imgformat=None, imgquality=95, optimizeimg=None, rendermode="normal", north_direction='lower-left'):
|
def __init__(self, worldobj, destdir, bgcolor, depth=None, tiledir=None, forcerender=False, imgformat=None, imgquality=95, optimizeimg=None, rendermode="normal"):
|
||||||
"""Generates a quadtree from the world given into the
|
"""Generates a quadtree from the world given into the
|
||||||
given dest directory
|
given dest directory
|
||||||
|
|
||||||
@@ -66,7 +66,6 @@ class QuadtreeGen(object):
|
|||||||
self.optimizeimg = optimizeimg
|
self.optimizeimg = optimizeimg
|
||||||
self.bgcolor = bgcolor
|
self.bgcolor = bgcolor
|
||||||
self.rendermode = rendermode
|
self.rendermode = rendermode
|
||||||
self.north_direction = north_direction
|
|
||||||
|
|
||||||
# force png renderformat if we're using an overlay mode
|
# force png renderformat if we're using an overlay mode
|
||||||
if 'overlay' in get_render_mode_inheritance(rendermode):
|
if 'overlay' in get_render_mode_inheritance(rendermode):
|
||||||
|
|||||||
@@ -65,8 +65,8 @@ def pool_initializer(rendernode):
|
|||||||
|
|
||||||
# make sure textures are generated for this process
|
# make sure textures are generated for this process
|
||||||
# and initialize c_overviewer
|
# and initialize c_overviewer
|
||||||
textures.generate(north_direction=rendernode.options.get('north_direction', None),
|
textures.generate(path=rendernode.options.get('textures_path', None),
|
||||||
path=rendernode.options.get('textures_path', None))
|
north_direction=rendernode.options.get('north_direction', None))
|
||||||
c_overviewer.init_chunk_render()
|
c_overviewer.init_chunk_render()
|
||||||
|
|
||||||
# load biome data in each process, if needed
|
# load biome data in each process, if needed
|
||||||
|
|||||||
@@ -511,10 +511,10 @@ def generate_texture_tuple(img, blockid):
|
|||||||
blockmap list and specialblockmap dictionary."""
|
blockmap list and specialblockmap dictionary."""
|
||||||
return (img.convert("RGB"), img.split()[3], generate_opaque_mask(img))
|
return (img.convert("RGB"), img.split()[3], generate_opaque_mask(img))
|
||||||
|
|
||||||
def generate_special_texture(blockID, data, north_direction):
|
def generate_special_texture(blockID, data):
|
||||||
"""Generates a special texture, such as a correctly facing minecraft track"""
|
"""Generates a special texture, such as a correctly facing minecraft track"""
|
||||||
|
|
||||||
data = convert_data(blockID, data, north_direction)
|
data = convert_data(blockID, data)
|
||||||
|
|
||||||
# blocks need to be handled here (and in chunk.py)
|
# blocks need to be handled here (and in chunk.py)
|
||||||
|
|
||||||
@@ -1680,37 +1680,37 @@ def generate_special_texture(blockID, data, north_direction):
|
|||||||
|
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def convert_data(blockID, data, north_direction):
|
def convert_data(blockID, data):
|
||||||
if blockID == 26: # bed
|
if blockID == 26: # bed
|
||||||
#Masked to not clobber block head/foot info
|
#Masked to not clobber block head/foot info
|
||||||
if north_direction == 'upper-left':
|
if _north == 'upper-left':
|
||||||
if (data & 0b0011) == 0: data = data & 0b1100 | 1
|
if (data & 0b0011) == 0: data = data & 0b1100 | 1
|
||||||
elif (data & 0b0011) == 1: data = data & 0b1100 | 2
|
elif (data & 0b0011) == 1: data = data & 0b1100 | 2
|
||||||
elif (data & 0b0011) == 2: data = data & 0b1100 | 3
|
elif (data & 0b0011) == 2: data = data & 0b1100 | 3
|
||||||
elif (data & 0b0011) == 3: data = data & 0b1100 | 0
|
elif (data & 0b0011) == 3: data = data & 0b1100 | 0
|
||||||
elif north_direction == 'upper-right':
|
elif _north == 'upper-right':
|
||||||
if (data & 0b0011) == 0: data = data & 0b1100 | 2
|
if (data & 0b0011) == 0: data = data & 0b1100 | 2
|
||||||
elif (data & 0b0011) == 1: data = data & 0b1100 | 3
|
elif (data & 0b0011) == 1: data = data & 0b1100 | 3
|
||||||
elif (data & 0b0011) == 2: data = data & 0b1100 | 0
|
elif (data & 0b0011) == 2: data = data & 0b1100 | 0
|
||||||
elif (data & 0b0011) == 3: data = data & 0b1100 | 1
|
elif (data & 0b0011) == 3: data = data & 0b1100 | 1
|
||||||
elif north_direction == 'lower-right':
|
elif _north == 'lower-right':
|
||||||
if (data & 0b0011) == 0: data = data & 0b1100 | 3
|
if (data & 0b0011) == 0: data = data & 0b1100 | 3
|
||||||
elif (data & 0b0011) == 1: data = data & 0b1100 | 0
|
elif (data & 0b0011) == 1: data = data & 0b1100 | 0
|
||||||
elif (data & 0b0011) == 2: data = data & 0b1100 | 1
|
elif (data & 0b0011) == 2: data = data & 0b1100 | 1
|
||||||
elif (data & 0b0011) == 3: data = data & 0b1100 | 2
|
elif (data & 0b0011) == 3: data = data & 0b1100 | 2
|
||||||
if blockID in (29, 33, 34): # sticky piston, piston, piston extension
|
if blockID in (29, 33, 34): # sticky piston, piston, piston extension
|
||||||
#Masked to not clobber block head/foot info
|
#Masked to not clobber block head/foot info
|
||||||
if north_direction == 'upper-left':
|
if _north == 'upper-left':
|
||||||
if (data & 0b0111) == 2: data = data & 0b1000 | 5
|
if (data & 0b0111) == 2: data = data & 0b1000 | 5
|
||||||
elif (data & 0b0111) == 3: data = data & 0b1000 | 4
|
elif (data & 0b0111) == 3: data = data & 0b1000 | 4
|
||||||
elif (data & 0b0111) == 4: data = data & 0b1000 | 2
|
elif (data & 0b0111) == 4: data = data & 0b1000 | 2
|
||||||
elif (data & 0b0111) == 5: data = data & 0b1000 | 3
|
elif (data & 0b0111) == 5: data = data & 0b1000 | 3
|
||||||
elif north_direction == 'upper-right':
|
elif _north == 'upper-right':
|
||||||
if (data & 0b0111) == 2: data = data & 0b1000 | 3
|
if (data & 0b0111) == 2: data = data & 0b1000 | 3
|
||||||
elif (data & 0b0111) == 3: data = data & 0b1000 | 2
|
elif (data & 0b0111) == 3: data = data & 0b1000 | 2
|
||||||
elif (data & 0b0111) == 4: data = data & 0b1000 | 5
|
elif (data & 0b0111) == 4: data = data & 0b1000 | 5
|
||||||
elif (data & 0b0111) == 5: data = data & 0b1000 | 4
|
elif (data & 0b0111) == 5: data = data & 0b1000 | 4
|
||||||
elif north_direction == 'lower-right':
|
elif _north == 'lower-right':
|
||||||
if (data & 0b0111) == 2: data = data & 0b1000 | 4
|
if (data & 0b0111) == 2: data = data & 0b1000 | 4
|
||||||
elif (data & 0b0111) == 3: data = data & 0b1000 | 5
|
elif (data & 0b0111) == 3: data = data & 0b1000 | 5
|
||||||
elif (data & 0b0111) == 4: data = data & 0b1000 | 3
|
elif (data & 0b0111) == 4: data = data & 0b1000 | 3
|
||||||
@@ -1718,19 +1718,19 @@ def convert_data(blockID, data, north_direction):
|
|||||||
if blockID in (27, 28, 66): # minetrack:
|
if blockID in (27, 28, 66): # minetrack:
|
||||||
#Masked to not clobber powered rail on/off info
|
#Masked to not clobber powered rail on/off info
|
||||||
#Ascending and flat straight
|
#Ascending and flat straight
|
||||||
if north_direction == 'upper-left':
|
if _north == 'upper-left':
|
||||||
if (data & 0b0111) == 0: data = data & 0b1000 | 1
|
if (data & 0b0111) == 0: data = data & 0b1000 | 1
|
||||||
elif (data & 0b0111) == 1: data = data & 0b1000 | 0
|
elif (data & 0b0111) == 1: data = data & 0b1000 | 0
|
||||||
elif (data & 0b0111) == 2: data = data & 0b1000 | 5
|
elif (data & 0b0111) == 2: data = data & 0b1000 | 5
|
||||||
elif (data & 0b0111) == 3: data = data & 0b1000 | 4
|
elif (data & 0b0111) == 3: data = data & 0b1000 | 4
|
||||||
elif (data & 0b0111) == 4: data = data & 0b1000 | 2
|
elif (data & 0b0111) == 4: data = data & 0b1000 | 2
|
||||||
elif (data & 0b0111) == 5: data = data & 0b1000 | 3
|
elif (data & 0b0111) == 5: data = data & 0b1000 | 3
|
||||||
elif north_direction == 'upper-right':
|
elif _north == 'upper-right':
|
||||||
if (data & 0b0111) == 2: data = data & 0b1000 | 3
|
if (data & 0b0111) == 2: data = data & 0b1000 | 3
|
||||||
elif (data & 0b0111) == 3: data = data & 0b1000 | 2
|
elif (data & 0b0111) == 3: data = data & 0b1000 | 2
|
||||||
elif (data & 0b0111) == 4: data = data & 0b1000 | 5
|
elif (data & 0b0111) == 4: data = data & 0b1000 | 5
|
||||||
elif (data & 0b0111) == 5: data = data & 0b1000 | 4
|
elif (data & 0b0111) == 5: data = data & 0b1000 | 4
|
||||||
elif north_direction == 'lower-right':
|
elif _north == 'lower-right':
|
||||||
if (data & 0b0111) == 0: data = data & 0b1000 | 1
|
if (data & 0b0111) == 0: data = data & 0b1000 | 1
|
||||||
elif (data & 0b0111) == 1: data = data & 0b1000 | 0
|
elif (data & 0b0111) == 1: data = data & 0b1000 | 0
|
||||||
elif (data & 0b0111) == 2: data = data & 0b1000 | 4
|
elif (data & 0b0111) == 2: data = data & 0b1000 | 4
|
||||||
@@ -1739,171 +1739,171 @@ def convert_data(blockID, data, north_direction):
|
|||||||
elif (data & 0b0111) == 5: data = data & 0b1000 | 2
|
elif (data & 0b0111) == 5: data = data & 0b1000 | 2
|
||||||
if blockID == 66: # normal minetrack only
|
if blockID == 66: # normal minetrack only
|
||||||
#Corners
|
#Corners
|
||||||
if north_direction == 'upper-left':
|
if _north == 'upper-left':
|
||||||
if data == 6: data = 7
|
if data == 6: data = 7
|
||||||
elif data == 7: data = 8
|
elif data == 7: data = 8
|
||||||
elif data == 8: data = 6
|
elif data == 8: data = 6
|
||||||
elif data == 9: data = 9
|
elif data == 9: data = 9
|
||||||
elif north_direction == 'upper-right':
|
elif _north == 'upper-right':
|
||||||
if data == 6: data = 8
|
if data == 6: data = 8
|
||||||
elif data == 7: data = 9
|
elif data == 7: data = 9
|
||||||
elif data == 8: data = 6
|
elif data == 8: data = 6
|
||||||
elif data == 9: data = 7
|
elif data == 9: data = 7
|
||||||
elif north_direction == 'lower-right':
|
elif _north == 'lower-right':
|
||||||
if data == 6: data = 9
|
if data == 6: data = 9
|
||||||
elif data == 7: data = 6
|
elif data == 7: data = 6
|
||||||
elif data == 8: data = 8
|
elif data == 8: data = 8
|
||||||
elif data == 9: data = 7
|
elif data == 9: data = 7
|
||||||
if blockID in (50, 75, 76): # torch, off/on redstone torch
|
if blockID in (50, 75, 76): # torch, off/on redstone torch
|
||||||
if north_direction == 'upper-left':
|
if _north == 'upper-left':
|
||||||
if data == 1: data = 3
|
if data == 1: data = 3
|
||||||
elif data == 2: data = 4
|
elif data == 2: data = 4
|
||||||
elif data == 3: data = 2
|
elif data == 3: data = 2
|
||||||
elif data == 4: data = 1
|
elif data == 4: data = 1
|
||||||
elif north_direction == 'upper-right':
|
elif _north == 'upper-right':
|
||||||
if data == 1: data = 2
|
if data == 1: data = 2
|
||||||
elif data == 2: data = 1
|
elif data == 2: data = 1
|
||||||
elif data == 3: data = 4
|
elif data == 3: data = 4
|
||||||
elif data == 4: data = 3
|
elif data == 4: data = 3
|
||||||
elif north_direction == 'lower-right':
|
elif _north == 'lower-right':
|
||||||
if data == 1: data = 4
|
if data == 1: data = 4
|
||||||
elif data == 2: data = 3
|
elif data == 2: data = 3
|
||||||
elif data == 3: data = 1
|
elif data == 3: data = 1
|
||||||
elif data == 4: data = 2
|
elif data == 4: data = 2
|
||||||
if blockID in (53,67): # wooden and cobblestone stairs.
|
if blockID in (53,67): # wooden and cobblestone stairs.
|
||||||
if north_direction == 'upper-left':
|
if _north == 'upper-left':
|
||||||
if data == 0: data = 2
|
if data == 0: data = 2
|
||||||
elif data == 1: data = 3
|
elif data == 1: data = 3
|
||||||
elif data == 2: data = 1
|
elif data == 2: data = 1
|
||||||
elif data == 3: data = 0
|
elif data == 3: data = 0
|
||||||
elif north_direction == 'upper-right':
|
elif _north == 'upper-right':
|
||||||
if data == 0: data = 1
|
if data == 0: data = 1
|
||||||
elif data == 1: data = 0
|
elif data == 1: data = 0
|
||||||
elif data == 2: data = 3
|
elif data == 2: data = 3
|
||||||
elif data == 3: data = 2
|
elif data == 3: data = 2
|
||||||
elif north_direction == 'lower-right':
|
elif _north == 'lower-right':
|
||||||
if data == 0: data = 3
|
if data == 0: data = 3
|
||||||
elif data == 1: data = 2
|
elif data == 1: data = 2
|
||||||
elif data == 2: data = 0
|
elif data == 2: data = 0
|
||||||
elif data == 3: data = 1
|
elif data == 3: data = 1
|
||||||
if blockID in (61, 62, 23): # furnace and burning furnace
|
if blockID in (61, 62, 23): # furnace and burning furnace
|
||||||
if north_direction == 'upper-left':
|
if _north == 'upper-left':
|
||||||
if data == 2: data = 5
|
if data == 2: data = 5
|
||||||
elif data == 3: data = 4
|
elif data == 3: data = 4
|
||||||
elif data == 4: data = 2
|
elif data == 4: data = 2
|
||||||
elif data == 5: data = 3
|
elif data == 5: data = 3
|
||||||
elif north_direction == 'upper-right':
|
elif _north == 'upper-right':
|
||||||
if data == 2: data = 3
|
if data == 2: data = 3
|
||||||
elif data == 3: data = 2
|
elif data == 3: data = 2
|
||||||
elif data == 4: data = 5
|
elif data == 4: data = 5
|
||||||
elif data == 5: data = 4
|
elif data == 5: data = 4
|
||||||
elif north_direction == 'lower-right':
|
elif _north == 'lower-right':
|
||||||
if data == 2: data = 4
|
if data == 2: data = 4
|
||||||
elif data == 3: data = 5
|
elif data == 3: data = 5
|
||||||
elif data == 4: data = 3
|
elif data == 4: data = 3
|
||||||
elif data == 5: data = 2
|
elif data == 5: data = 2
|
||||||
if blockID == 63: # signposts
|
if blockID == 63: # signposts
|
||||||
if north_direction == 'upper-left':
|
if _north == 'upper-left':
|
||||||
data = (data + 4) % 16
|
data = (data + 4) % 16
|
||||||
elif north_direction == 'upper-right':
|
elif _north == 'upper-right':
|
||||||
data = (data + 8) % 16
|
data = (data + 8) % 16
|
||||||
elif north_direction == 'lower-right':
|
elif _north == 'lower-right':
|
||||||
data = (data + 12) % 16
|
data = (data + 12) % 16
|
||||||
if blockID in (64,71): # wooden/iron door
|
if blockID in (64,71): # wooden/iron door
|
||||||
#Masked to not clobber block top/bottom & swung info
|
#Masked to not clobber block top/bottom & swung info
|
||||||
if north_direction == 'upper-left':
|
if _north == 'upper-left':
|
||||||
if (data & 0b0011) == 0: data = data & 0b1100 | 1
|
if (data & 0b0011) == 0: data = data & 0b1100 | 1
|
||||||
elif (data & 0b0011) == 1: data = data & 0b1100 | 2
|
elif (data & 0b0011) == 1: data = data & 0b1100 | 2
|
||||||
elif (data & 0b0011) == 2: data = data & 0b1100 | 3
|
elif (data & 0b0011) == 2: data = data & 0b1100 | 3
|
||||||
elif (data & 0b0011) == 3: data = data & 0b1100 | 0
|
elif (data & 0b0011) == 3: data = data & 0b1100 | 0
|
||||||
elif north_direction == 'upper-right':
|
elif _north == 'upper-right':
|
||||||
if (data & 0b0011) == 0: data = data & 0b1100 | 2
|
if (data & 0b0011) == 0: data = data & 0b1100 | 2
|
||||||
elif (data & 0b0011) == 1: data = data & 0b1100 | 3
|
elif (data & 0b0011) == 1: data = data & 0b1100 | 3
|
||||||
elif (data & 0b0011) == 2: data = data & 0b1100 | 0
|
elif (data & 0b0011) == 2: data = data & 0b1100 | 0
|
||||||
elif (data & 0b0011) == 3: data = data & 0b1100 | 1
|
elif (data & 0b0011) == 3: data = data & 0b1100 | 1
|
||||||
elif north_direction == 'lower-right':
|
elif _north == 'lower-right':
|
||||||
if (data & 0b0011) == 0: data = data & 0b1100 | 3
|
if (data & 0b0011) == 0: data = data & 0b1100 | 3
|
||||||
elif (data & 0b0011) == 1: data = data & 0b1100 | 0
|
elif (data & 0b0011) == 1: data = data & 0b1100 | 0
|
||||||
elif (data & 0b0011) == 2: data = data & 0b1100 | 1
|
elif (data & 0b0011) == 2: data = data & 0b1100 | 1
|
||||||
elif (data & 0b0011) == 3: data = data & 0b1100 | 2
|
elif (data & 0b0011) == 3: data = data & 0b1100 | 2
|
||||||
if blockID == 65: # ladder
|
if blockID == 65: # ladder
|
||||||
if north_direction == 'upper-left':
|
if _north == 'upper-left':
|
||||||
if data == 2: data = 5
|
if data == 2: data = 5
|
||||||
elif data == 3: data = 4
|
elif data == 3: data = 4
|
||||||
elif data == 4: data = 2
|
elif data == 4: data = 2
|
||||||
elif data == 5: data = 3
|
elif data == 5: data = 3
|
||||||
elif north_direction == 'upper-right':
|
elif _north == 'upper-right':
|
||||||
if data == 2: data = 3
|
if data == 2: data = 3
|
||||||
elif data == 3: data = 2
|
elif data == 3: data = 2
|
||||||
elif data == 4: data = 5
|
elif data == 4: data = 5
|
||||||
elif data == 5: data = 4
|
elif data == 5: data = 4
|
||||||
elif north_direction == 'lower-right':
|
elif _north == 'lower-right':
|
||||||
if data == 2: data = 4
|
if data == 2: data = 4
|
||||||
elif data == 3: data = 5
|
elif data == 3: data = 5
|
||||||
elif data == 4: data = 3
|
elif data == 4: data = 3
|
||||||
elif data == 5: data = 2
|
elif data == 5: data = 2
|
||||||
if blockID == 68: # wall sign
|
if blockID == 68: # wall sign
|
||||||
if north_direction == 'upper-left':
|
if _north == 'upper-left':
|
||||||
if data == 2: data = 5
|
if data == 2: data = 5
|
||||||
elif data == 3: data = 4
|
elif data == 3: data = 4
|
||||||
elif data == 4: data = 2
|
elif data == 4: data = 2
|
||||||
elif data == 5: data = 3
|
elif data == 5: data = 3
|
||||||
elif north_direction == 'upper-right':
|
elif _north == 'upper-right':
|
||||||
if data == 2: data = 3
|
if data == 2: data = 3
|
||||||
elif data == 3: data = 2
|
elif data == 3: data = 2
|
||||||
elif data == 4: data = 5
|
elif data == 4: data = 5
|
||||||
elif data == 5: data = 4
|
elif data == 5: data = 4
|
||||||
elif north_direction == 'lower-right':
|
elif _north == 'lower-right':
|
||||||
if data == 2: data = 4
|
if data == 2: data = 4
|
||||||
elif data == 3: data = 5
|
elif data == 3: data = 5
|
||||||
elif data == 4: data = 3
|
elif data == 4: data = 3
|
||||||
elif data == 5: data = 2
|
elif data == 5: data = 2
|
||||||
if blockID in (86,91): # pumpkins, jack-o-lantern
|
if blockID in (86,91): # pumpkins, jack-o-lantern
|
||||||
if north_direction == 'upper-left':
|
if _north == 'upper-left':
|
||||||
if data == 0: data = 1
|
if data == 0: data = 1
|
||||||
elif data == 1: data = 2
|
elif data == 1: data = 2
|
||||||
elif data == 2: data = 3
|
elif data == 2: data = 3
|
||||||
elif data == 3: data = 0
|
elif data == 3: data = 0
|
||||||
elif north_direction == 'upper-right':
|
elif _north == 'upper-right':
|
||||||
if data == 0: data = 2
|
if data == 0: data = 2
|
||||||
elif data == 1: data = 3
|
elif data == 1: data = 3
|
||||||
elif data == 2: data = 0
|
elif data == 2: data = 0
|
||||||
elif data == 3: data = 1
|
elif data == 3: data = 1
|
||||||
elif north_direction == 'lower-right':
|
elif _north == 'lower-right':
|
||||||
if data == 0: data = 3
|
if data == 0: data = 3
|
||||||
elif data == 1: data = 0
|
elif data == 1: data = 0
|
||||||
elif data == 2: data = 1
|
elif data == 2: data = 1
|
||||||
elif data == 3: data = 2
|
elif data == 3: data = 2
|
||||||
if blockID in (93, 94): # redstone repeaters, ON and OFF
|
if blockID in (93, 94): # redstone repeaters, ON and OFF
|
||||||
#Masked to not clobber delay info
|
#Masked to not clobber delay info
|
||||||
if north_direction == 'upper-left':
|
if _north == 'upper-left':
|
||||||
if (data & 0b0011) == 0: data = data & 0b1100 | 1
|
if (data & 0b0011) == 0: data = data & 0b1100 | 1
|
||||||
elif (data & 0b0011) == 1: data = data & 0b1100 | 2
|
elif (data & 0b0011) == 1: data = data & 0b1100 | 2
|
||||||
elif (data & 0b0011) == 2: data = data & 0b1100 | 3
|
elif (data & 0b0011) == 2: data = data & 0b1100 | 3
|
||||||
elif (data & 0b0011) == 3: data = data & 0b1100 | 0
|
elif (data & 0b0011) == 3: data = data & 0b1100 | 0
|
||||||
elif north_direction == 'upper-right':
|
elif _north == 'upper-right':
|
||||||
if (data & 0b0011) == 0: data = data & 0b1100 | 2
|
if (data & 0b0011) == 0: data = data & 0b1100 | 2
|
||||||
elif (data & 0b0011) == 1: data = data & 0b1100 | 3
|
elif (data & 0b0011) == 1: data = data & 0b1100 | 3
|
||||||
elif (data & 0b0011) == 2: data = data & 0b1100 | 0
|
elif (data & 0b0011) == 2: data = data & 0b1100 | 0
|
||||||
elif (data & 0b0011) == 3: data = data & 0b1100 | 1
|
elif (data & 0b0011) == 3: data = data & 0b1100 | 1
|
||||||
elif north_direction == 'lower-right':
|
elif _north == 'lower-right':
|
||||||
if (data & 0b0011) == 0: data = data & 0b1100 | 3
|
if (data & 0b0011) == 0: data = data & 0b1100 | 3
|
||||||
elif (data & 0b0011) == 1: data = data & 0b1100 | 0
|
elif (data & 0b0011) == 1: data = data & 0b1100 | 0
|
||||||
elif (data & 0b0011) == 2: data = data & 0b1100 | 1
|
elif (data & 0b0011) == 2: data = data & 0b1100 | 1
|
||||||
elif (data & 0b0011) == 3: data = data & 0b1100 | 2
|
elif (data & 0b0011) == 3: data = data & 0b1100 | 2
|
||||||
if blockID == 96: # trapdoor
|
if blockID == 96: # trapdoor
|
||||||
#Masked to not clobber opened/closed info
|
#Masked to not clobber opened/closed info
|
||||||
if north_direction == 'upper-left':
|
if _north == 'upper-left':
|
||||||
if (data & 0b0011) == 0: data = data & 0b1100 | 3
|
if (data & 0b0011) == 0: data = data & 0b1100 | 3
|
||||||
elif (data & 0b0011) == 1: data = data & 0b1100 | 2
|
elif (data & 0b0011) == 1: data = data & 0b1100 | 2
|
||||||
elif (data & 0b0011) == 2: data = data & 0b1100 | 0
|
elif (data & 0b0011) == 2: data = data & 0b1100 | 0
|
||||||
elif (data & 0b0011) == 3: data = data & 0b1100 | 1
|
elif (data & 0b0011) == 3: data = data & 0b1100 | 1
|
||||||
elif north_direction == 'upper-right':
|
elif _north == 'upper-right':
|
||||||
if (data & 0b0011) == 0: data = data & 0b1100 | 1
|
if (data & 0b0011) == 0: data = data & 0b1100 | 1
|
||||||
elif (data & 0b0011) == 1: data = data & 0b1100 | 0
|
elif (data & 0b0011) == 1: data = data & 0b1100 | 0
|
||||||
elif (data & 0b0011) == 2: data = data & 0b1100 | 3
|
elif (data & 0b0011) == 2: data = data & 0b1100 | 3
|
||||||
elif (data & 0b0011) == 3: data = data & 0b1100 | 2
|
elif (data & 0b0011) == 3: data = data & 0b1100 | 2
|
||||||
elif north_direction == 'lower-right':
|
elif _north == 'lower-right':
|
||||||
if (data & 0b0011) == 0: data = data & 0b1100 | 2
|
if (data & 0b0011) == 0: data = data & 0b1100 | 2
|
||||||
elif (data & 0b0011) == 1: data = data & 0b1100 | 3
|
elif (data & 0b0011) == 1: data = data & 0b1100 | 3
|
||||||
elif (data & 0b0011) == 2: data = data & 0b1100 | 1
|
elif (data & 0b0011) == 2: data = data & 0b1100 | 1
|
||||||
@@ -1957,7 +1957,12 @@ def getBiomeData(worlddir, chunkX, chunkY):
|
|||||||
biomeX = chunkX // 32
|
biomeX = chunkX // 32
|
||||||
biomeY = chunkY // 32
|
biomeY = chunkY // 32
|
||||||
rots = 0
|
rots = 0
|
||||||
if _north == 'upper-right':
|
if _north == 'upper-left':
|
||||||
|
temp = biomeX
|
||||||
|
biomeX = biomeY
|
||||||
|
biomeY = -temp-1
|
||||||
|
rots = 3
|
||||||
|
elif _north == 'upper-right':
|
||||||
biomeX = -biomeX-1
|
biomeX = -biomeX-1
|
||||||
biomeY = -biomeY-1
|
biomeY = -biomeY-1
|
||||||
rots = 2
|
rots = 2
|
||||||
@@ -1966,11 +1971,6 @@ def getBiomeData(worlddir, chunkX, chunkY):
|
|||||||
biomeX = -biomeY-1
|
biomeX = -biomeY-1
|
||||||
biomeY = temp
|
biomeY = temp
|
||||||
rots = 1
|
rots = 1
|
||||||
elif _north == 'upper-left':
|
|
||||||
temp = biomeX
|
|
||||||
biomeX = biomeY
|
|
||||||
biomeY = -temp-1
|
|
||||||
rots = 3
|
|
||||||
|
|
||||||
biomeFile = "b.%d.%d.biome" % (biomeX, biomeY)
|
biomeFile = "b.%d.%d.biome" % (biomeX, biomeY)
|
||||||
if biomeFile == currentBiomeFile:
|
if biomeFile == currentBiomeFile:
|
||||||
@@ -2103,7 +2103,7 @@ def generate(path=None,texture_size=24,bgc = (26,26,26,0),north_direction='lower
|
|||||||
specialblockmap = {}
|
specialblockmap = {}
|
||||||
for blockID in special_blocks:
|
for blockID in special_blocks:
|
||||||
for data in special_map[blockID]:
|
for data in special_map[blockID]:
|
||||||
specialblockmap[(blockID, data)] = generate_special_texture(blockID, data, north_direction)
|
specialblockmap[(blockID, data)] = generate_special_texture(blockID, data)
|
||||||
|
|
||||||
if texture_size != 24:
|
if texture_size != 24:
|
||||||
# rescale biome textures.
|
# rescale biome textures.
|
||||||
|
|||||||
@@ -218,13 +218,13 @@ 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-right':
|
if self.north_direction == 'upper-left':
|
||||||
spawnX = -spawnX
|
|
||||||
spawnZ = -spawnZ
|
|
||||||
elif self.north_direction == 'upper-left':
|
|
||||||
temp = spawnX
|
temp = spawnX
|
||||||
spawnX = -spawnZ
|
spawnX = -spawnZ
|
||||||
spawnZ = temp
|
spawnZ = temp
|
||||||
|
elif self.north_direction == 'upper-right':
|
||||||
|
spawnX = -spawnX
|
||||||
|
spawnZ = -spawnZ
|
||||||
elif self.north_direction == 'lower-right':
|
elif self.north_direction == 'lower-right':
|
||||||
temp = spawnX
|
temp = spawnX
|
||||||
spawnX = spawnZ
|
spawnX = spawnZ
|
||||||
@@ -304,13 +304,13 @@ class World(object):
|
|||||||
self.findTrueSpawn()
|
self.findTrueSpawn()
|
||||||
|
|
||||||
def _get_north_rotations(self):
|
def _get_north_rotations(self):
|
||||||
if self.north_direction == "upper-left":
|
if self.north_direction == 'upper-left':
|
||||||
return 1
|
return 1
|
||||||
elif self.north_direction == "upper-right":
|
elif self.north_direction == 'upper-right':
|
||||||
return 2
|
return 2
|
||||||
elif self.north_direction == "lower-right":
|
elif self.north_direction == 'lower-right':
|
||||||
return 3
|
return 3
|
||||||
elif self.north_direction == "lower-left":
|
elif self.north_direction == 'lower-left':
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
def _iterate_regionfiles(self,regionlist=None):
|
def _iterate_regionfiles(self,regionlist=None):
|
||||||
@@ -331,13 +331,13 @@ class World(object):
|
|||||||
logging.debug("Using path %s from regionlist", f)
|
logging.debug("Using path %s from regionlist", f)
|
||||||
x = int(p[1])
|
x = int(p[1])
|
||||||
y = int(p[2])
|
y = int(p[2])
|
||||||
if self.north_direction == 'upper-right':
|
if self.north_direction == 'upper-left':
|
||||||
x = -x-1
|
|
||||||
y = -y-1
|
|
||||||
elif self.north_direction == 'upper-left':
|
|
||||||
temp = x
|
temp = x
|
||||||
x = -y-1
|
x = -y-1
|
||||||
y = temp
|
y = temp
|
||||||
|
elif self.north_direction == 'upper-right':
|
||||||
|
x = -x-1
|
||||||
|
y = -y-1
|
||||||
elif self.north_direction == 'lower-right':
|
elif self.north_direction == 'lower-right':
|
||||||
temp = x
|
temp = x
|
||||||
x = y
|
x = y
|
||||||
@@ -352,13 +352,13 @@ class World(object):
|
|||||||
p = f.split(".")
|
p = f.split(".")
|
||||||
x = int(p[1])
|
x = int(p[1])
|
||||||
y = int(p[2])
|
y = int(p[2])
|
||||||
if self.north_direction == 'upper-right':
|
if self.north_direction == 'upper-left':
|
||||||
x = -x-1
|
|
||||||
y = -y-1
|
|
||||||
elif self.north_direction == 'upper-left':
|
|
||||||
temp = x
|
temp = x
|
||||||
x = -y-1
|
x = -y-1
|
||||||
y = temp
|
y = temp
|
||||||
|
elif self.north_direction == 'upper-right':
|
||||||
|
x = -x-1
|
||||||
|
y = -y-1
|
||||||
elif self.north_direction == 'lower-right':
|
elif self.north_direction == 'lower-right':
|
||||||
temp = x
|
temp = x
|
||||||
x = y
|
x = y
|
||||||
|
|||||||
Reference in New Issue
Block a user