0

Fix whitespace formatting, make snow 1/4th of block

This commit is contained in:
Sam Steele
2010-09-30 22:47:10 -07:00
parent e54f375295
commit 5d22e1cd6f
2 changed files with 22 additions and 9 deletions

View File

@@ -334,17 +334,19 @@ class ChunkRenderer(object):
img.paste(t[0], (imgx, imgy), t[1]) img.paste(t[0], (imgx, imgy), t[1])
# Draw edge lines # Draw edge lines
if blockid in (44,78,): # step block, snow if blockid in (44,): # step block
half = 6 increment = 6
else: elif blockid in (78,): # snow
half = 0 increment = 9
else:
increment = 0
if blockid not in transparent_blocks: if blockid not in transparent_blocks:
draw = ImageDraw.Draw(img) draw = ImageDraw.Draw(img)
if x != 15 and blocks[x+1,y,z] == 0: if x != 15 and blocks[x+1,y,z] == 0:
draw.line(((imgx+12,imgy+half), (imgx+22,imgy+5+half)), 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: if y != 0 and blocks[x,y-1,z] == 0:
draw.line(((imgx,imgy+6+half), (imgx+12,imgy+half)), fill=(0,0,0), width=1) draw.line(((imgx,imgy+6+increment), (imgx+12,imgy+increment)), fill=(0,0,0), width=1)
finally: finally:

View File

@@ -151,14 +151,20 @@ def _transform_image_side(img, blockID):
"""Takes an image and shears it for the left side of the cube (reflect for """Takes an image and shears it for the left side of the cube (reflect for
the right side)""" the right side)"""
if blockID in (44,78,): # step block, snow 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 # (don't just crop img, since we want the size of
# img to be unchanged # img to be unchanged
mask = img.crop((0,8,16,16)) mask = img.crop((0,8,16,16))
n = Image.new(img.mode, img.size, (38,92,255,0)) n = Image.new(img.mode, img.size, (38,92,255,0))
n.paste(mask,(0,0,16,8), mask) n.paste(mask,(0,0,16,8), mask)
img = n 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 # Size of the cube side before shear
img = img.resize((12,12)) img = img.resize((12,12))
@@ -215,11 +221,16 @@ def _build_block(top, side, blockID=None):
img.paste(side, (2,6), side) img.paste(side, (2,6), side)
img.paste(otherside, (10,6), otherside) img.paste(otherside, (10,6), otherside)
img.paste(top, (0,2), top) img.paste(top, (0,2), top)
elif blockID in (44,78,): # half step, snow elif blockID in (44,): # half step
# shift each texture down 6 pixels # shift each texture down 6 pixels
img.paste(side, (0,12), side) img.paste(side, (0,12), side)
img.paste(otherside, (12,12), otherside) img.paste(otherside, (12,12), otherside)
img.paste(top, (0,6), top) 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: else:
img.paste(side, (0,6), side) img.paste(side, (0,6), side)
img.paste(otherside, (12,6), otherside) img.paste(otherside, (12,6), otherside)