From 9ecaf14fba4736ecdab96cde7f9c481dab485fb3 Mon Sep 17 00:00:00 2001 From: Andrew Chin Date: Sat, 10 Sep 2011 17:21:02 -0400 Subject: [PATCH 1/9] Added support for brick stairs and slabs --- overviewer_core/textures.py | 37 +++++++++++++++++++++++++------------ 1 file changed, 25 insertions(+), 12 deletions(-) diff --git a/overviewer_core/textures.py b/overviewer_core/textures.py index 7b8bac6..390df5f 100644 --- a/overviewer_core/textures.py +++ b/overviewer_core/textures.py @@ -435,8 +435,10 @@ def _build_blockimages(): 36, 37, -1, -1, 65, -1, -1, -1, 50, 24, -1, -1, 86, -1, -1, -1, # 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 -1, -1, -1, -1, -1, -1, -1, -1, -1, 51, 51, -1, -1, -1, 66, -1, - # 80 81 82 83 84 85 86 87 88 89 90 91 - 66, 69, 72, 73, 75, -1,102,103,104,105,-1, 102 # clay? + # 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 + 66, 69, 72, 73, 75, -1,102,103,104,105,-1, 102, -1, -1, -1, -1, + # 96 97 98 99 100 + -1, -1, 54, -1, -1 ] # NOTE: For non-block textures, the sideid is ignored, but can't be -1 @@ -452,8 +454,10 @@ def _build_blockimages(): 36, 37, -1, -1, 65, -1, -1,101, 50, 24, -1, -1, 86, -1, -1, -1, # 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 -1, -1, -1, -1, -1, -1, -1, -1, -1, 51, 51, -1, -1, -1, 66, -1, - # 80 81 82 83 84 85 86 87 88 89 90 91 - 66, 70, 72, 73, 74,-1 ,118,103,104,105, -1, 118 + # 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 + 66, 70, 72, 73, 74,-1 ,118,103,104,105, -1, 118,-1, -1, -1, -1, + # 96 97 98 99 100 + -1, -1, 54, -1, -1 ] # This maps block id to the texture that goes on the side of the block @@ -845,13 +849,17 @@ def generate_special_texture(blockID, data): if data == 0: # stone slab top = terrain_images[6] side = terrain_images[5] - if data == 1: # stone slab + elif data == 1: # stone slab top = terrain_images[176] side = terrain_images[192] - if data == 2: # wooden slab + elif data == 2: # wooden slab top = side = terrain_images[4] - if data == 3: # cobblestone slab + elif data == 3: # cobblestone slab top = side = terrain_images[16] + elif data == 4: # brick? + top = side = terrain_images[7] + elif data == 5: # stone brick? + top = side = terrain_images[54] img = _build_block(top, side, blockID) return generate_texture_tuple(img, blockID) @@ -926,13 +934,16 @@ def generate_special_texture(blockID, data): return generate_texture_tuple(img, blockID) - if blockID in (53,67): # wooden and cobblestone stairs. + if blockID in (53,67, 108, 109): # wooden, stone brick, and cobblestone stairs. if blockID == 53: # wooden texture = terrain_images[4] - elif blockID == 67: # cobblestone texture = terrain_images[16] + elif blockID == 108: # red brick stairs + texture = terrain_images[7] + elif blockID == 109: # stone brick stairs + texture = terrain_images[54] side = texture.copy() half_block_u = texture.copy() # up, down, left, right @@ -2008,7 +2019,7 @@ def getBiomeData(worlddir, chunkX, chunkY): special_blocks = set([ 2, 6, 9, 17, 18, 20, 26, 23, 27, 28, 29, 31, 33, 34, 35, 43, 44, 50, 51, 53, 54, 55, 58, 59, 61, 62, 63, 64, 65, 66, 67, 68, 71, 75, 76, 79, 85, 86, 90, - 91, 92, 93, 94, 96]) + 91, 92, 93, 94, 96, 108, 109]) # this is a map of special blockIDs to a list of all # possible values for ancillary data that it might have. @@ -2027,8 +2038,8 @@ special_map[29] = (0,1,2,3,4,5,8,9,10,11,12,13) # sticky piston body, orientatio special_map[33] = (0,1,2,3,4,5,8,9,10,11,12,13) # normal piston body, orientation, pushed in/out special_map[34] = (0,1,2,3,4,5,8,9,10,11,12,13) # normal and sticky piston extension, orientation, sticky/normal special_map[35] = range(16) # wool, colored and white -special_map[43] = range(4) # stone, sandstone, wooden and cobblestone double-slab -special_map[44] = range(4) # stone, sandstone, wooden and cobblestone slab +special_map[43] = range(6) # stone, sandstone, wooden and cobblestone double-slab +special_map[44] = range(6) # stone, sandstone, wooden and cobblestone slab special_map[50] = (1,2,3,4,5) # torch, position in the block special_map[51] = range(16) # fire, position in the block (not implemented) special_map[53] = range(4) # wooden stairs, orientation @@ -2056,6 +2067,8 @@ special_map[92] = range(6) # cake, eaten amount, (not implemented) special_map[93] = range(16) # OFF redstone repeater, orientation and delay special_map[94] = range(16) # ON redstone repeater, orientation and delay special_map[96] = range(8) # trapdoor, open, closed, orientation +special_map[108]= range(4) # red stairs, orientation +special_map[109]= range(4) # stonebrick stairs, orientation # grass and leaves are graysacle in terrain.png # we treat them as special so we can manually tint them From bdeefe4118b4b90b3ed765073eafa6c9f7759c4a Mon Sep 17 00:00:00 2001 From: Alejandro Aguilera Date: Sun, 11 Sep 2011 13:30:45 +0200 Subject: [PATCH 2/9] Update the list of transparent blocks. Added: iron bars, glass pane, pumpkin and melon stem, vines, fence gates, brick and stone brick stairs. --- overviewer_core/chunk.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/overviewer_core/chunk.py b/overviewer_core/chunk.py index 3b5269e..3fdaf4a 100644 --- a/overviewer_core/chunk.py +++ b/overviewer_core/chunk.py @@ -129,7 +129,8 @@ def get_tileentity_data(level): transparent_blocks = set([ 0, 6, 8, 9, 18, 20, 26, 27, 28, 29, 30, 31, 32, 33, 34, 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, 90, 92, 93, 94, 96]) + 81, 83, 85, 90, 92, 93, 94, 96, 101, 102, 104, 105, + 106, 107, 108, 109]) # 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, From 17c6d85c3e857d9ae0936510fd7313678c1e8162 Mon Sep 17 00:00:00 2001 From: Alejandro Aguilera Date: Sun, 11 Sep 2011 13:40:21 +0200 Subject: [PATCH 3/9] Added melon block. --- overviewer_core/textures.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/overviewer_core/textures.py b/overviewer_core/textures.py index 390df5f..4ecdf04 100644 --- a/overviewer_core/textures.py +++ b/overviewer_core/textures.py @@ -437,8 +437,8 @@ def _build_blockimages(): -1, -1, -1, -1, -1, -1, -1, -1, -1, 51, 51, -1, -1, -1, 66, -1, # 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 66, 69, 72, 73, 75, -1,102,103,104,105,-1, 102, -1, -1, -1, -1, - # 96 97 98 99 100 - -1, -1, 54, -1, -1 + # 96 97 98 99 100 101 102 103 + -1, -1, 54, -1, -1, -1, -1, 137, ] # NOTE: For non-block textures, the sideid is ignored, but can't be -1 @@ -456,8 +456,8 @@ def _build_blockimages(): -1, -1, -1, -1, -1, -1, -1, -1, -1, 51, 51, -1, -1, -1, 66, -1, # 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 66, 70, 72, 73, 74,-1 ,118,103,104,105, -1, 118,-1, -1, -1, -1, - # 96 97 98 99 100 - -1, -1, 54, -1, -1 + # 96 97 98 99 100 101 102 103 + -1, -1, 54, -1, -1, -1, -1, 136, ] # This maps block id to the texture that goes on the side of the block From d7bb11b2b4aa9f765a5d9265c7567d35a6d26f54 Mon Sep 17 00:00:00 2001 From: Alejandro Aguilera Date: Sun, 11 Sep 2011 15:15:53 +0200 Subject: [PATCH 4/9] Added glass panes and iron bars. Is not marvellous, but it works! --- overviewer_core/src/iterate.c | 9 +++++--- overviewer_core/textures.py | 41 ++++++++++++++++++++++++++++++++++- 2 files changed, 46 insertions(+), 4 deletions(-) diff --git a/overviewer_core/src/iterate.c b/overviewer_core/src/iterate.c index 6fd58bf..eff653f 100644 --- a/overviewer_core/src/iterate.c +++ b/overviewer_core/src/iterate.c @@ -283,7 +283,9 @@ generate_pseudo_data(RenderState *state, unsigned char ancilData) { return final_data; - } else if (state->block == 90) { + /* fences, iron bars and glass panes */ + } else if ((state->block == 90) || (state->block == 101) || + (state->block == 102)) { return check_adjacent_blocks(state, x, y, z, state->block); } @@ -413,11 +415,12 @@ chunk_render(PyObject *self, PyObject *args) { state.block_data = ancilData; /* block that need pseudo ancildata: * grass, water, glass, chest, restone wire, - * ice, fence and portal. */ + * ice, fence, portal, iron bars, glass panes */ if ((state.block == 2) || (state.block == 9) || (state.block == 20) || (state.block == 54) || (state.block == 55) || (state.block == 79) || - (state.block == 85) || (state.block == 90)) { + (state.block == 85) || (state.block == 90) || + (state.block == 101) || (state.block == 102)) { ancilData = generate_pseudo_data(&state, ancilData); state.block_pdata = ancilData; } else { diff --git a/overviewer_core/textures.py b/overviewer_core/textures.py index 4ecdf04..1a2432c 100644 --- a/overviewer_core/textures.py +++ b/overviewer_core/textures.py @@ -1693,6 +1693,43 @@ def generate_special_texture(blockID, data): return generate_texture_tuple(img, blockID) + if blockID == 101 or blockID == 102: # iron bars and glass panes + if blockID == 101: + # iron bars + t = terrain_images[85] + else: + # glass panes + t = terrain_images[49] + left = t.copy() + right = t.copy() + + # generate the four small pieces of the glass pane + ImageDraw.Draw(right).rectangle((0,0,7,15),outline=(0,0,0,0),fill=(0,0,0,0)) + ImageDraw.Draw(left).rectangle((8,0,15,15),outline=(0,0,0,0),fill=(0,0,0,0)) + + up_left = transform_image_side(left) + up_right = transform_image_side(right).transpose(Image.FLIP_TOP_BOTTOM) + dw_right = transform_image_side(right) + dw_left = transform_image_side(left).transpose(Image.FLIP_TOP_BOTTOM) + + # Create img to compose the texture + img = Image.new("RGBA", (24,24), bgcolor) + + # +x axis points top right direction + # +y axis points bottom right direction + # First compose things in the back of the image, + # then things in the front. + + if (data & 0b0001) == 1 or data == 0: + composite.alpha_over(img,up_left, (6,3),up_left) # top left + if (data & 0b1000) == 8 or data == 0: + composite.alpha_over(img,up_right, (6,3),up_right) # top right + if (data & 0b0010) == 2 or data == 0: + composite.alpha_over(img,dw_left, (6,3),dw_left) # bottom left + if (data & 0b0100) == 4 or data == 0: + composite.alpha_over(img,dw_right, (6,3),dw_right) # bottom right + + return generate_texture_tuple(img, blockID) return None @@ -2019,7 +2056,7 @@ def getBiomeData(worlddir, chunkX, chunkY): special_blocks = set([ 2, 6, 9, 17, 18, 20, 26, 23, 27, 28, 29, 31, 33, 34, 35, 43, 44, 50, 51, 53, 54, 55, 58, 59, 61, 62, 63, 64, 65, 66, 67, 68, 71, 75, 76, 79, 85, 86, 90, - 91, 92, 93, 94, 96, 108, 109]) + 91, 92, 93, 94, 96, 101, 102, 108, 109]) # this is a map of special blockIDs to a list of all # possible values for ancillary data that it might have. @@ -2067,6 +2104,8 @@ special_map[92] = range(6) # cake, eaten amount, (not implemented) special_map[93] = range(16) # OFF redstone repeater, orientation and delay special_map[94] = range(16) # ON redstone repeater, orientation and delay special_map[96] = range(8) # trapdoor, open, closed, orientation +special_map[101]= range(16) # iron bars, all the possible combination, uses pseudo data +special_map[102]= range(16) # glass panes, all the possible combination, uses pseudo data special_map[108]= range(4) # red stairs, orientation special_map[109]= range(4) # stonebrick stairs, orientation From 4701490c3e3304f949e720e114347b8d9b2d7913 Mon Sep 17 00:00:00 2001 From: Andrew Chin Date: Sun, 11 Sep 2011 11:44:53 -0400 Subject: [PATCH 5/9] Fixed lighting and rotation issues for new stairs --- overviewer_core/src/rendermode-lighting.c | 6 +++--- overviewer_core/textures.py | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/overviewer_core/src/rendermode-lighting.c b/overviewer_core/src/rendermode-lighting.c index 1774e1a..476d1d2 100644 --- a/overviewer_core/src/rendermode-lighting.c +++ b/overviewer_core/src/rendermode-lighting.c @@ -117,7 +117,7 @@ estimate_blocklevel(RenderModeLighting *self, RenderState *state, blocklevel = getArrayByte3D(blocklight, local_x, local_y, local_z); /* no longer a guess */ - if (!(block == 44 || block == 53 || block == 67) && authoratative) { + if (!(block == 44 || block == 53 || block == 67 || block == 108 || block == 109) && authoratative) { *authoratative = 1; } @@ -173,7 +173,7 @@ get_lighting_coefficient(RenderModeLighting *self, RenderState *state, blocklevel = getArrayByte3D(blocklight, local_x, local_y, local_z); /* special half-step handling */ - if (block == 44 || block == 53 || block == 67) { + if (block == 44 || block == 53 || block == 67 || block == 108 || block == 109) { unsigned int upper_block; /* stairs and half-blocks take the skylevel from the upper block if it's transparent */ @@ -183,7 +183,7 @@ get_lighting_coefficient(RenderModeLighting *self, RenderState *state, do { upper_counter++; upper_block = getArrayByte3D(blocks, local_x, local_y, local_z + upper_counter); - } while ((upper_block == 44 || upper_block == 54 || upper_block == 67) && local_z < 127); + } while ((upper_block == 44 || upper_block == 53 || upper_block == 67 || upper_block == 108 || upper_block == 109) && local_z < 127); if (is_transparent(upper_block)) { skylevel = getArrayByte3D(skylight, local_x, local_y, local_z + upper_counter); } diff --git a/overviewer_core/textures.py b/overviewer_core/textures.py index 1a2432c..7b8f743 100644 --- a/overviewer_core/textures.py +++ b/overviewer_core/textures.py @@ -1823,7 +1823,7 @@ def convert_data(blockID, data): elif data == 2: data = 3 elif data == 3: data = 1 elif data == 4: data = 2 - if blockID in (53,67): # wooden and cobblestone stairs. + if blockID in (53,67,108,109): # wooden and cobblestone stairs. if _north == 'upper-left': if data == 0: data = 2 elif data == 1: data = 3 From a06da78d9ead521edce7aee91bcc1b854e373e18 Mon Sep 17 00:00:00 2001 From: Alejandro Aguilera Date: Sun, 11 Sep 2011 19:21:45 +0200 Subject: [PATCH 6/9] Add huge mushrroms. --- overviewer_core/textures.py | 76 ++++++++++++++++++++++++++++++++++++- 1 file changed, 74 insertions(+), 2 deletions(-) diff --git a/overviewer_core/textures.py b/overviewer_core/textures.py index 7b8f743..5517391 100644 --- a/overviewer_core/textures.py +++ b/overviewer_core/textures.py @@ -1693,6 +1693,49 @@ def generate_special_texture(blockID, data): return generate_texture_tuple(img, blockID) + if blockID == 99 or blockID == 100: # huge brown and red mushroom + if blockID == 99: # brown + cap = terrain_images[126] + else: # red + cap = terrain_images[125] + stem = terrain_images[141] + porous = terrain_images[142] + + if data == 0: # fleshy piece + img = _build_full_block(porous, None, None, porous, porous) + + if data == 1: # north-east corner + img = _build_full_block(cap, None, None, cap, porous) + + if data == 2: # east side + img = _build_full_block(cap, None, None, porous, porous) + + if data == 3: # south-east corner + img = _build_full_block(cap, None, None, porous, cap) + + if data == 4: # north side + img = _build_full_block(cap, None, None, cap, porous) + + if data == 5: # top piece + img = _build_full_block(cap, None, None, porous, porous) + + if data == 6: # south side + img = _build_full_block(cap, None, None, cap, porous) + + if data == 7: # north-west corner + img = _build_full_block(cap, None, None, cap, cap) + + if data == 8: # west side + img = _build_full_block(cap, None, None, porous, cap) + + if data == 9: # south-west corner + img = _build_full_block(cap, None, None, porous, cap) + + if data == 10: # stem + img = _build_full_block(porous, None, None, stem, stem) + + return generate_texture_tuple(img, blockID) + if blockID == 101 or blockID == 102: # iron bars and glass panes if blockID == 101: # iron bars @@ -1961,7 +2004,34 @@ def convert_data(blockID, data): elif (data & 0b0011) == 1: data = data & 0b1100 | 3 elif (data & 0b0011) == 2: data = data & 0b1100 | 1 elif (data & 0b0011) == 3: data = data & 0b1100 | 0 - + if blockID == 99 or blockID == 100: # huge red and brown mushroom + if _north == 'upper-left': + if data == 1: data = 3 + elif data == 2: data = 6 + elif data == 3: data = 9 + elif data == 4: data = 2 + elif data == 6: data = 8 + elif data == 7: data = 1 + elif data == 8: data = 4 + elif data == 9: data = 7 + elif _north == 'upper-right': + if data == 1: data = 9 + elif data == 2: data = 8 + elif data == 3: data = 7 + elif data == 4: data = 6 + elif data == 6: data = 4 + elif data == 7: data = 3 + elif data == 8: data = 2 + elif data == 9: data = 1 + elif _north == 'lower-right': + if data == 1: data = 7 + elif data == 2: data = 4 + elif data == 3: data = 1 + elif data == 4: data = 2 + elif data == 6: data = 8 + elif data == 7: data = 9 + elif data == 8: data = 6 + elif data == 9: data = 3 return data def tintTexture(im, c): @@ -2056,7 +2126,7 @@ def getBiomeData(worlddir, chunkX, chunkY): special_blocks = set([ 2, 6, 9, 17, 18, 20, 26, 23, 27, 28, 29, 31, 33, 34, 35, 43, 44, 50, 51, 53, 54, 55, 58, 59, 61, 62, 63, 64, 65, 66, 67, 68, 71, 75, 76, 79, 85, 86, 90, - 91, 92, 93, 94, 96, 101, 102, 108, 109]) + 91, 92, 93, 94, 96, 99, 100, 101, 102, 108, 109]) # this is a map of special blockIDs to a list of all # possible values for ancillary data that it might have. @@ -2104,6 +2174,8 @@ special_map[92] = range(6) # cake, eaten amount, (not implemented) special_map[93] = range(16) # OFF redstone repeater, orientation and delay special_map[94] = range(16) # ON redstone repeater, orientation and delay special_map[96] = range(8) # trapdoor, open, closed, orientation +special_map[99] = range(11) # huge brown mushroom, side, corner, etc, piece +special_map[100] = range(11) # huge red mushroom, side, corner, etc, piece special_map[101]= range(16) # iron bars, all the possible combination, uses pseudo data special_map[102]= range(16) # glass panes, all the possible combination, uses pseudo data special_map[108]= range(4) # red stairs, orientation From f97549f1f87185fe0701b06d7acee97db9d1a57e Mon Sep 17 00:00:00 2001 From: Alejandro Aguilera Date: Sun, 11 Sep 2011 19:29:49 +0200 Subject: [PATCH 7/9] Updated stone brick with mossy and cracked stone brick. --- overviewer_core/textures.py | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/overviewer_core/textures.py b/overviewer_core/textures.py index 5517391..3583582 100644 --- a/overviewer_core/textures.py +++ b/overviewer_core/textures.py @@ -438,7 +438,7 @@ def _build_blockimages(): # 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 66, 69, 72, 73, 75, -1,102,103,104,105,-1, 102, -1, -1, -1, -1, # 96 97 98 99 100 101 102 103 - -1, -1, 54, -1, -1, -1, -1, 137, + -1, -1, -1, -1, -1, -1, -1, 137, ] # NOTE: For non-block textures, the sideid is ignored, but can't be -1 @@ -457,7 +457,7 @@ def _build_blockimages(): # 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 66, 70, 72, 73, 74,-1 ,118,103,104,105, -1, 118,-1, -1, -1, -1, # 96 97 98 99 100 101 102 103 - -1, -1, 54, -1, -1, -1, -1, 136, + -1, -1, -1, -1, -1, -1, -1, 136, ] # This maps block id to the texture that goes on the side of the block @@ -1693,6 +1693,18 @@ def generate_special_texture(blockID, data): return generate_texture_tuple(img, blockID) + if blockID == 98: # normal, mossy and cracked stone brick + if data == 0: # normal + t = terrain_images[54] + elif data == 1: # mossy + t = terrain_images[100] + else: # cracked + t = terrain_images[101] + + img = _build_full_block(t, None, None, t, t) + + return generate_texture_tuple(img, blockID) + if blockID == 99 or blockID == 100: # huge brown and red mushroom if blockID == 99: # brown cap = terrain_images[126] @@ -2126,7 +2138,7 @@ def getBiomeData(worlddir, chunkX, chunkY): special_blocks = set([ 2, 6, 9, 17, 18, 20, 26, 23, 27, 28, 29, 31, 33, 34, 35, 43, 44, 50, 51, 53, 54, 55, 58, 59, 61, 62, 63, 64, 65, 66, 67, 68, 71, 75, 76, 79, 85, 86, 90, - 91, 92, 93, 94, 96, 99, 100, 101, 102, 108, 109]) + 91, 92, 93, 94, 96, 98, 99, 100, 101, 102, 108, 109]) # this is a map of special blockIDs to a list of all # possible values for ancillary data that it might have. @@ -2174,6 +2186,7 @@ special_map[92] = range(6) # cake, eaten amount, (not implemented) special_map[93] = range(16) # OFF redstone repeater, orientation and delay special_map[94] = range(16) # ON redstone repeater, orientation and delay special_map[96] = range(8) # trapdoor, open, closed, orientation +special_map[98] = range(3) # stone brick, normal, mossy and cracked special_map[99] = range(11) # huge brown mushroom, side, corner, etc, piece special_map[100] = range(11) # huge red mushroom, side, corner, etc, piece special_map[101]= range(16) # iron bars, all the possible combination, uses pseudo data From 0ab3b0b2df101feb8ed5be2f4ab140f3198182c5 Mon Sep 17 00:00:00 2001 From: CounterPillow Date: Sun, 11 Sep 2011 15:31:32 -0400 Subject: [PATCH 8/9] Added vines. --- overviewer_core/src/rendermode-normal.c | 5 ++++ overviewer_core/textures.py | 40 +++++++++++++++++++++++-- 2 files changed, 43 insertions(+), 2 deletions(-) diff --git a/overviewer_core/src/rendermode-normal.c b/overviewer_core/src/rendermode-normal.c index d85a298..5f71982 100644 --- a/overviewer_core/src/rendermode-normal.c +++ b/overviewer_core/src/rendermode-normal.c @@ -213,6 +213,11 @@ rendermode_normal_draw(void *data, RenderState *state, PyObject *src, PyObject * break; } break; + case 106: + /* vines */ + color = PySequence_GetItem(self->grasscolor, index); + facemask = mask; + break; default: break; }; diff --git a/overviewer_core/textures.py b/overviewer_core/textures.py index 7b8f743..45d6940 100644 --- a/overviewer_core/textures.py +++ b/overviewer_core/textures.py @@ -1730,6 +1730,26 @@ def generate_special_texture(blockID, data): composite.alpha_over(img,dw_right, (6,3),dw_right) # bottom right return generate_texture_tuple(img, blockID) + if blockID == 106: # vine + img = Image.new("RGBA", (24,24), bgcolor) + raw_texture = terrain_images[143] + # print "vine is facing: %d" % data + if data == 2: # don't trust these values - found by sheer luck. + tex = transform_image_side(raw_texture) + composite.alpha_over(img, tex, (0,6), tex) + return generate_texture_tuple(img, blockID) + if data == 3: + tex = transform_image_side(raw_texture).transpose(Image.FLIP_LEFT_RIGHT) + composite.alpha_over(img, tex, (12,6), tex) + return generate_texture_tuple(img, blockID) + if data == 4: + tex = transform_image_side(raw_texture).transpose(Image.FLIP_LEFT_RIGHT) + composite.alpha_over(img, tex, (0,0), tex) + return generate_texture_tuple(img, blockID) + if data == 5: + tex = transform_image_side(raw_texture) + composite.alpha_over(img, tex, (12,0), tex) + return generate_texture_tuple(img, blockID) return None @@ -1961,7 +1981,22 @@ def convert_data(blockID, data): elif (data & 0b0011) == 1: data = data & 0b1100 | 3 elif (data & 0b0011) == 2: data = data & 0b1100 | 1 elif (data & 0b0011) == 3: data = data & 0b1100 | 0 - + if blockID == 106: # vine + if _north == 'upper-left': + if data == 2: data = 5 + elif data == 3: data = 4 + elif data == 4: data = 2 + elif data == 5: data = 3 + elif _north == 'upper-right': + if data == 2: data = 3 + elif data == 3: data = 2 + elif data == 4: data = 5 + elif data == 5: data = 4 + elif _north == 'lower-right': + if data == 2: data = 4 + elif data == 3: data = 5 + elif data == 4: data = 3 + elif data == 5: data = 2 return data def tintTexture(im, c): @@ -2056,7 +2091,7 @@ def getBiomeData(worlddir, chunkX, chunkY): special_blocks = set([ 2, 6, 9, 17, 18, 20, 26, 23, 27, 28, 29, 31, 33, 34, 35, 43, 44, 50, 51, 53, 54, 55, 58, 59, 61, 62, 63, 64, 65, 66, 67, 68, 71, 75, 76, 79, 85, 86, 90, - 91, 92, 93, 94, 96, 101, 102, 108, 109]) + 91, 92, 93, 94, 96, 101, 102, 106, 108, 109]) # this is a map of special blockIDs to a list of all # possible values for ancillary data that it might have. @@ -2106,6 +2141,7 @@ special_map[94] = range(16) # ON redstone repeater, orientation and delay special_map[96] = range(8) # trapdoor, open, closed, orientation special_map[101]= range(16) # iron bars, all the possible combination, uses pseudo data special_map[102]= range(16) # glass panes, all the possible combination, uses pseudo data +special_map[106] = (2,3,4,5) # vine, orientation special_map[108]= range(4) # red stairs, orientation special_map[109]= range(4) # stonebrick stairs, orientation From b0e6502094d5db8c29821d74c51a24cfa6193703 Mon Sep 17 00:00:00 2001 From: CounterPillow Date: Mon, 12 Sep 2011 01:40:24 +0200 Subject: [PATCH 9/9] Fixed vines. --- overviewer_core/textures.py | 39 ++++++++++++++++++++----------------- 1 file changed, 21 insertions(+), 18 deletions(-) diff --git a/overviewer_core/textures.py b/overviewer_core/textures.py index 9d3fc83..6889792 100644 --- a/overviewer_core/textures.py +++ b/overviewer_core/textures.py @@ -1789,19 +1789,19 @@ def generate_special_texture(blockID, data): img = Image.new("RGBA", (24,24), bgcolor) raw_texture = terrain_images[143] # print "vine is facing: %d" % data - if data == 2: # don't trust these values - found by sheer luck. + if data == 2: # south tex = transform_image_side(raw_texture) composite.alpha_over(img, tex, (0,6), tex) return generate_texture_tuple(img, blockID) - if data == 3: + if data == 1: # east tex = transform_image_side(raw_texture).transpose(Image.FLIP_LEFT_RIGHT) composite.alpha_over(img, tex, (12,6), tex) return generate_texture_tuple(img, blockID) - if data == 4: + if data == 4: # west tex = transform_image_side(raw_texture).transpose(Image.FLIP_LEFT_RIGHT) composite.alpha_over(img, tex, (0,0), tex) return generate_texture_tuple(img, blockID) - if data == 5: + if data == 8: # north tex = transform_image_side(raw_texture) composite.alpha_over(img, tex, (12,0), tex) return generate_texture_tuple(img, blockID) @@ -2066,20 +2066,20 @@ def convert_data(blockID, data): elif data == 9: data = 3 if blockID == 106: # vine if _north == 'upper-left': - if data == 2: data = 5 - elif data == 3: data = 4 - elif data == 4: data = 2 - elif data == 5: data = 3 + if data == 1: data = 2 + elif data == 4: data = 8 + elif data == 8: data = 1 + elif data == 2: data = 4 elif _north == 'upper-right': - if data == 2: data = 3 - elif data == 3: data = 2 - elif data == 4: data = 5 - elif data == 5: data = 4 + if data == 1: data = 4 + elif data == 4: data = 1 + elif data == 8: data = 2 + elif data == 2: data = 8 elif _north == 'lower-right': - if data == 2: data = 4 - elif data == 3: data = 5 - elif data == 4: data = 3 - elif data == 5: data = 2 + if data == 1: data = 8 + elif data == 4: data = 2 + elif data == 8: data = 4 + elif data == 2: data = 1 return data def tintTexture(im, c): @@ -2228,7 +2228,7 @@ special_map[99] = range(11) # huge brown mushroom, side, corner, etc, piece special_map[100] = range(11) # huge red mushroom, side, corner, etc, piece special_map[101]= range(16) # iron bars, all the possible combination, uses pseudo data special_map[102]= range(16) # glass panes, all the possible combination, uses pseudo data -special_map[106] = (2,3,4,5) # vine, orientation +special_map[106] = (1,2,4,8) # vine, orientation special_map[108]= range(4) # red stairs, orientation special_map[109]= range(4) # stonebrick stairs, orientation @@ -2251,6 +2251,7 @@ biome_grass_texture = None biome_tall_grass_texture = None biome_tall_fern_texture = None biome_leaf_texture = None +biome_vine_texture = None specialblockmap = None def generate(path=None,texture_size=24,bgc = (26,26,26,0),north_direction='lower-left'): @@ -2273,11 +2274,12 @@ def generate(path=None,texture_size=24,bgc = (26,26,26,0),north_direction='lower load_water() # generate biome (still grayscale) leaf, grass textures - global biome_grass_texture, biome_leaf_texture, biome_tall_grass_texture, biome_tall_fern_texture + global biome_grass_texture, biome_leaf_texture, biome_tall_grass_texture, biome_tall_fern_texture, biome_vine_texture biome_grass_texture = _build_block(terrain_images[0], terrain_images[38], 2) biome_leaf_texture = _build_block(terrain_images[52], terrain_images[52], 18) biome_tall_grass_texture = _build_block(terrain_images[39], terrain_images[39], 31) biome_tall_fern_texture = _build_block(terrain_images[56], terrain_images[56], 31) + biome_vine_texture = _build_block(terrain_images[143], terrain_images[143], 106) # generate the special blocks global specialblockmap, special_blocks @@ -2292,6 +2294,7 @@ def generate(path=None,texture_size=24,bgc = (26,26,26,0),north_direction='lower biome_leaf_texture = biome_leaf_texture.resize(texture_dimensions, Image.ANTIALIAS) biome_tall_grass_texture = biome_tall_grass_texture.resize(texture_dimensions, Image.ANTIALIAS) biome_tall_fern_texture = biome_tall_fern_texture.resize(texture_dimensions, Image.ANTIALIAS) + biome_vine_texture = biome_vine_texture.resize(texture_dimensions, Image.ANTIALIAS) # rescale the normal block images for i in range(len(blockmap)):