From 805450e5f4c386d8b520f3abef21efa3a691befa Mon Sep 17 00:00:00 2001 From: Alejandro Aguilera Date: Sun, 27 Mar 2011 14:42:21 +0200 Subject: [PATCH] Add cake to textures.py (cake!) --- chunk.py | 4 ++-- textures.py | 35 ++++++++++++++++++++++++++++++++--- 2 files changed, 34 insertions(+), 5 deletions(-) diff --git a/chunk.py b/chunk.py index 6a02669..99019b6 100644 --- a/chunk.py +++ b/chunk.py @@ -115,12 +115,12 @@ def get_tileentity_data(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, 55, - 59, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 74, 75, 76, 77, 78, 79, 81, 83, 85]) + 59, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 74, 75, 76, 77, 78, 79, 81, 83, 85, 92]) # This set holds block ids that are solid blocks solid_blocks = set([1, 2, 3, 4, 5, 7, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 35, 41, 42, 43, 44, 45, 46, 47, 48, 49, 53, 54, 56, 57, 58, 60, - 61, 62, 64, 65, 66, 67, 71, 73, 74, 78, 79, 80, 81, 82, 84, 86, 87, 88, 89, 91]) + 61, 62, 64, 65, 66, 67, 71, 73, 74, 78, 79, 80, 81, 82, 84, 86, 87, 88, 89, 91, 92]) # This set holds block ids that are fluid blocks fluid_blocks = set([8,9,10,11]) diff --git a/textures.py b/textures.py index ec7d034..565d194 100644 --- a/textures.py +++ b/textures.py @@ -121,8 +121,8 @@ def transform_image(img, blockID=None): """ - if blockID in (81,): # cacti - # Resize to 15x15, since the cactus texture is a little smaller than the other textures + if blockID in (81,92): # cacti and cake + # Resize to 15x15, since the cactus and the cake textures are a little smaller than the other textures img = img.resize((15, 15), Image.BILINEAR) else: @@ -977,6 +977,34 @@ def generate_special_texture(blockID, data): return (img.convert("RGB"),img.split()[3]) + + if blockID == 92: # cake! (without bites, at the moment) + + top = terrain_images[121] + side = terrain_images[122] + top = transform_image(top, blockID) + side = transform_image_side(side, blockID) + otherside = side.transpose(Image.FLIP_LEFT_RIGHT) + + sidealpha = side.split()[3] + side = ImageEnhance.Brightness(side).enhance(0.9) + side.putalpha(sidealpha) + othersidealpha = otherside.split()[3] + otherside = ImageEnhance.Brightness(otherside).enhance(0.8) + otherside.putalpha(othersidealpha) + + img = Image.new("RGBA", (24,24), (38,92,255,0)) + + composite.alpha_over(img, side, (2,12), side) + composite.alpha_over(img, otherside, (10,12), otherside) + composite.alpha_over(img, top, (0,8), top) + + #~ composite.alpha_over(img, side, (2,6), side) + #~ composite.alpha_over(img, otherside, (10,6), otherside) + #~ composite.alpha_over(img, top, (0,2), top) + return (img.convert("RGB"), img.split()[3]) + + return None def tintTexture(im, c): @@ -1050,7 +1078,7 @@ def getBiomeData(worlddir, chunkX, chunkY): # This set holds block ids that require special pre-computing. These are typically # things that require ancillary data to render properly (i.e. ladder plus orientation) -special_blocks = set([66,59,61,62, 65,64,71,91,86,2,18,85,17,23,35,51,43,44,9,55,58]) +special_blocks = set([66,59,61,62, 65,64,71,91,86,2,18,85,17,23,35,51,43,44,9,55,58,92]) # this is a map of special blockIDs to a list of all # possible values for ancillary data that it might have. @@ -1074,6 +1102,7 @@ special_map[44] = range(4) # stone, sandstone, wooden and cobblestone slab special_map[9] = range(32) # water: spring,flowing, waterfall, and others (unknown) ancildata values. special_map[55] = range(128) # redstone wire special_map[58] = (0,) # crafting table +special_map[92] = range(6) # cake! # apparently pumpkins and jack-o-lanterns have ancillary data, but it's unknown # what that data represents. For now, assume that the range for data is 0 to 5