diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..0d20b64 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +*.pyc diff --git a/chunk.py b/chunk.py index a1deab1..1fe427b 100644 --- a/chunk.py +++ b/chunk.py @@ -66,7 +66,7 @@ def get_blockdata_array(level): # This set holds blocks ids that can be seen through, for occlusion calculations transparent_blocks = set([0, 6, 8, 9, 18, 20, 37, 38, 39, 40, 44, 50, 51, 52, 53, - 59, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 74, 75, 76, 77, 79, 81, 83, 85]) + 59, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 74, 75, 76, 77, 78, 79, 81, 83, 85]) def render_and_save(chunkfile, cachedir, cave=False): """Used as the entry point for the multiprocessing workers (since processes @@ -337,12 +337,19 @@ class ChunkRenderer(object): img.paste(t[0], (imgx, imgy), t[1]) # Draw edge lines - if blockid not in transparent_blocks: + if blockid in (44,): # step block + increment = 6 + elif blockid in (78,): # snow + increment = 9 + else: + increment = 0 + + if blockid not in transparent_blocks or blockid in (78,): #special case snow so the outline is still drawn draw = ImageDraw.Draw(img) if x != 15 and blocks[x+1,y,z] == 0: - draw.line(((imgx+12,imgy), (imgx+22,imgy+5)), fill=(0,0,0), width=1) + draw.line(((imgx+12,imgy+increment), (imgx+22,imgy+5+increment)), fill=(0,0,0), width=1) if y != 0 and blocks[x,y-1,z] == 0: - draw.line(((imgx,imgy+6), (imgx+12,imgy)), fill=(0,0,0), width=1) + draw.line(((imgx,imgy+6+increment), (imgx+12,imgy+increment)), fill=(0,0,0), width=1) finally: diff --git a/textures.py b/textures.py index 755dae7..1ba595c 100644 --- a/textures.py +++ b/textures.py @@ -152,13 +152,19 @@ def _transform_image_side(img, blockID=None): the right side)""" if blockID in (44,): # step block - # make the top half transpartent + # make the top half transparent # (don't just crop img, since we want the size of # img to be unchanged mask = img.crop((0,8,16,16)) n = Image.new(img.mode, img.size, (38,92,255,0)) n.paste(mask,(0,0,16,8), mask) img = n + if blockID in (78,): # snow + # make the top three quarters transparent + mask = img.crop((0,12,16,16)) + n = Image.new(img.mode, img.size, (38,92,255,0)) + n.paste(mask,(0,12,16,16), mask) + img = n # Size of the cube side before shear img = img.resize((12,12)) @@ -220,6 +226,11 @@ def _build_block(top, side, blockID=None): img.paste(side, (0,12), side) img.paste(otherside, (12,12), otherside) img.paste(top, (0,6), top) + elif blockID in (78,): # snow + # shift each texture down 9 pixels + img.paste(side, (0,6), side) + img.paste(otherside, (12,6), otherside) + img.paste(top, (0,9), top) else: img.paste(side, (0,6), side) img.paste(otherside, (12,6), otherside)