From cf971c17c6b7735d496501f43f63c953241353db Mon Sep 17 00:00:00 2001 From: Sam Steele Date: Thu, 30 Sep 2010 18:36:10 -0700 Subject: [PATCH] Render snow as half-blocks --- chunk.py | 9 +++++++-- textures.py | 4 ++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/chunk.py b/chunk.py index fef3a84..aa2aed1 100644 --- a/chunk.py +++ b/chunk.py @@ -312,12 +312,17 @@ class ChunkRenderer(object): img.paste(t[0], (imgx, imgy), t[1]) # Draw edge lines + if blockid in (44,78,): # step block, snow + half = 6 + else: + half = 0 + if blockid not in transparent_blocks: 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+half), (imgx+22,imgy+5+half)), 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+half), (imgx+12,imgy+half)), fill=(0,0,0), width=1) finally: diff --git a/textures.py b/textures.py index 8d34b03..320d980 100644 --- a/textures.py +++ b/textures.py @@ -151,7 +151,7 @@ def _transform_image_side(img, blockID): """Takes an image and shears it for the left side of the cube (reflect for the right side)""" - if blockID in (44,): # step block + if blockID in (44,78,): # step block, snow # make the top half transpartent # (don't just crop img, since we want the size of # img to be unchanged @@ -213,7 +213,7 @@ def _build_block(top, side, blockID=None): img.paste(side, (2,6), side) img.paste(otherside, (10,6), otherside) img.paste(top, (0,2), top) - elif blockID in (44,): # half step + elif blockID in (44,78,): # half step, snow # shift each texture down 6 pixels img.paste(side, (0,12), side) img.paste(otherside, (12,12), otherside)