From 416e1b6b8588a3c4db2e95bd6fb565ea99b0e46d Mon Sep 17 00:00:00 2001 From: Alejandro Aguilera Date: Sun, 2 Jan 2011 16:23:42 +0100 Subject: [PATCH 1/9] Add textures for minetrack slopes in textures.py --- textures.py | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 50 insertions(+), 2 deletions(-) diff --git a/textures.py b/textures.py index 4c93b98..a3fc05e 100644 --- a/textures.py +++ b/textures.py @@ -179,6 +179,22 @@ def transform_image_side(img, blockID=None): newimg = img.transform((12,18), Image.AFFINE, transform) return newimg +def transform_image_slope(img, blockID=None): + """Takes an image and shears it in the shape of a slope going up + in the -y direction (reflect for +x direction). Used for minetracks""" + + # Take the same size as trasform_image_side + img = img.resize((12,12)) + + # Apply shear + transform = numpy.matrix(numpy.identity(3)) + transform *= numpy.matrix("[0.75,-0.5,3;0.25,0.5,-3;0,0,1]") + transform = numpy.array(transform)[:2,:].ravel().tolist() + + newimg = img.transform((24,24), Image.AFFINE, transform) + + return newimg + def _build_block(top, side, blockID=None): """From a top texture and a side texture, build a block image. @@ -362,14 +378,46 @@ def generate_special_texture(blockID, data): blockID) elif data == 1: track = transform_image(raw_straight.rotate(90), blockID) - else: - # TODO render carts that slop up or down + + #slopes + elif data == 2: # slope going up in +x direction + track = transform_image_slope(raw_straight,blockID) + track = track.transpose(Image.FLIP_LEFT_RIGHT) + img = Image.new("RGBA", (24,24), (38,92,255,0)) + composite.alpha_over(img, track, (2,0), track) + # the 2 pixels move is needed to fit with the adjacent tracks + return (img.convert("RGB"), img.split()[3]) + + elif data == 3: # slope going up in -x direction + # tracks are sprites, in this case we are seeing the "side" of + # the sprite, so draw a line to make it beautiful. + img = Image.new("RGBA", (24,24), (38,92,255,0)) + ImageDraw.Draw(img).line([(11,11),(23,17)],fill=(164,164,164)) + # grey from track texture (exterior grey). + # the track doesn't start from image corners, be carefull drawing the line! + return (img.convert("RGB"), img.split()[3]) + + elif data == 4: # slope going up in -y direction + track = transform_image_slope(raw_straight,blockID) + img = Image.new("RGBA", (24,24), (38,92,255,0)) + composite.alpha_over(img, track, (0,0), track) + return (img.convert("RGB"), img.split()[3]) + + elif data == 5: # slope going up in +y direction + # same as "data == 3" + img = Image.new("RGBA", (24,24), (38,92,255,0)) + ImageDraw.Draw(img).line([(1,17),(12,11)],fill=(164,164,164)) + return (img.convert("RGB"), img.split()[3]) + + + else: # just in case track = transform_image(raw_straight, blockID) img = Image.new("RGBA", (24,24), (38,92,255,0)) composite.alpha_over(img, track, (0,12), track) return (img.convert("RGB"), img.split()[3]) + if blockID == 59: # crops raw_crop = terrain_images[88+data] crop1 = transform_image(raw_crop, blockID) From 521a359139ccb82f6bf3be4e0defcf84acc07772 Mon Sep 17 00:00:00 2001 From: Andrew Chin Date: Sat, 8 Jan 2011 16:09:01 -0500 Subject: [PATCH 2/9] changes for py2exe --- setup.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/setup.py b/setup.py index 4348e6a..bd8c29f 100644 --- a/setup.py +++ b/setup.py @@ -4,6 +4,7 @@ from distutils.command.clean import clean from distutils.dir_util import remove_tree from distutils import log import os, os.path +import glob try: import py2exe @@ -24,15 +25,16 @@ setup_kwargs['cmdclass'] = {} if py2exe != None: setup_kwargs['console'] = ['gmap.py'] setup_kwargs['data_files'] = [('textures', ['textures/lava.png', 'textures/water.png']), - ('', ['template.html'])] + ('', ['config.js', 'COPYING.txt', 'README.rst']), + ('web_assets', glob.glob('web_assets/*'))] setup_kwargs['zipfile'] = None - setup_kwargs['options']['py2exe'] = {'bundle_files' : 1} + setup_kwargs['options']['py2exe'] = {'bundle_files' : 1, 'excludes': 'Tkinter'} # # _composite.c extension # -setup_kwargs['ext_modules'].append(Extension('_composite', ['_composite.c'], include_dirs=['.'])) +setup_kwargs['ext_modules'].append(Extension('_composite', ['_composite.c'], include_dirs=['.'], extra_link_args=["/MANIFEST"])) # tell build_ext to build the extension in-place # (NOT in build/) setup_kwargs['options']['build_ext'] = {'inplace' : 1} From 935d353ef1f018bfca1ca11511eb49696044e5a0 Mon Sep 17 00:00:00 2001 From: Andrew Chin Date: Mon, 10 Jan 2011 21:42:33 -0500 Subject: [PATCH 3/9] Fix build regression on non-windows platforms --- setup.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/setup.py b/setup.py index bd8c29f..bc4ca85 100644 --- a/setup.py +++ b/setup.py @@ -5,6 +5,7 @@ from distutils.dir_util import remove_tree from distutils import log import os, os.path import glob +import platform try: import py2exe @@ -34,7 +35,7 @@ if py2exe != None: # _composite.c extension # -setup_kwargs['ext_modules'].append(Extension('_composite', ['_composite.c'], include_dirs=['.'], extra_link_args=["/MANIFEST"])) +setup_kwargs['ext_modules'].append(Extension('_composite', ['_composite.c'], include_dirs=['.'], extra_link_args=["/MANIFEST"] if platform.system() == "Windows" else [])) # tell build_ext to build the extension in-place # (NOT in build/) setup_kwargs['options']['build_ext'] = {'inplace' : 1} From effaa204e04481cb8197c07cbb279f942a2f0a4b Mon Sep 17 00:00:00 2001 From: Alejandro Aguilera Date: Tue, 11 Jan 2011 10:10:31 +0100 Subject: [PATCH 4/9] Add blockid = 55 to the list of transparent blocks. --- chunk.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chunk.py b/chunk.py index 13a387b..6256862 100644 --- a/chunk.py +++ b/chunk.py @@ -109,7 +109,7 @@ def iterate_chunkblocks(xoff,yoff): # 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, +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]) # This set holds block ids that are solid blocks From 664d14dee37fe5778e65a8d460cbd3416666d363 Mon Sep 17 00:00:00 2001 From: Alejandro Aguilera Date: Sat, 15 Jan 2011 01:49:46 +0100 Subject: [PATCH 5/9] Add some Minecraft beta 1.2 blocks to the render support: -The 2 new woods -The dispensers -Chaged to the new top for the furnace (and I think fixed them) -Lapis lazuli block -Lapis lazuli ore -Note block -Sandstone --- chunk.py | 6 +++--- textures.py | 53 ++++++++++++++++++++++++++++++++++++++++++----------- 2 files changed, 45 insertions(+), 14 deletions(-) diff --git a/chunk.py b/chunk.py index 6256862..1e13326 100644 --- a/chunk.py +++ b/chunk.py @@ -113,9 +113,9 @@ 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, 78, 79, 81, 83, 85]) # 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, 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]) +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]) # 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 a3fc05e..05b07a2 100644 --- a/textures.py +++ b/textures.py @@ -277,11 +277,11 @@ def _build_blockimages(): # 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 topids = [ -1, 1, 0, 2, 16, 4, 15, 17,205,205,237,237, 18, 19, 32, 33, # 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 - 34, 21, 52, 48, 49, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, # Cloths are left out + 34, -1, 52, 48, 49,160,144, -1,176, 74, -1, -1, -1, -1, -1, -1, # Cloths are left out, sandstone (it has top, side, and bottom wich is ignored here), note block # 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 -1, -1, -1, 64, 64, 13, 12, 29, 28, 23, 22, 6, 6, 7, 8, 35, # Gold/iron blocks? Doublestep? TNT from above? # 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 - 36, 37, 80, -1, 65, 4, 25,101, 98, 24, 43, -1, 86, 1, 1, -1, # Torch from above? leaving out fire. Redstone wire? Crops/furnaces handled elsewhere. sign post + 36, 37, 80, -1, 65, 4, 25,101, 98, 24, 43, -1, 86, -1, -1, -1, # Torch from above? leaving out fire. Redstone wire? Crops/furnaces handled elsewhere. sign post # 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 -1, -1, -1, 16, -1, -1, -1, -1, -1, 51, 51, -1, -1, 1, 66, 67, # door,ladder left out. Minecart rail orientation # 80 81 82 83 84 85 86 87 88 89 90 91 @@ -294,11 +294,11 @@ def _build_blockimages(): # 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 sideids = [ -1, 1, 3, 2, 16, 4, 15, 17,205,205,237,237, 18, 19, 32, 33, # 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 - 34, 20, 52, 48, 49, -1, -1, -1, -1, -1, -1, -1,- 1, -1, -1, -1, + 34, -1, 52, 48, 49,160,144, -1,192, 74, -1, -1,- 1, -1, -1, -1, # 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 -1, -1, -1, 64, 64, 13, 12, 29, 28, 23, 22, 5, 5, 7, 8, 35, # 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 - 36, 37, 80, -1, 65, 4, 25,101, 98, 24, 43, -1, 86, 44, 61, -1, + 36, 37, 80, -1, 65, 4, 25,101, 98, 24, 43, -1, 86, -1, -1, -1, # 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 -1, -1, -1, 16, -1, -1, -1, -1, -1, 51, 51, -1, -1, 1, 66, 67, # 80 81 82 83 84 85 86 87 88 89 90 91 @@ -431,7 +431,7 @@ def generate_special_texture(blockID, data): return (img.convert("RGB"), img.split()[3]) if blockID == 61: #furnace - top = transform_image(terrain_images[1]) + top = transform_image(terrain_images[62]) side1 = transform_image_side(terrain_images[45]) side2 = transform_image_side(terrain_images[44]).transpose(Image.FLIP_LEFT_RIGHT) @@ -456,17 +456,31 @@ def generate_special_texture(blockID, data): return (img.convert("RGB"), img.split()[3]) if blockID == 62: # lit furnace - top = transform_image(terrain_images[1]) + top = transform_image(terrain_images[62]) side1 = transform_image_side(terrain_images[45]) side2 = transform_image_side(terrain_images[45+16]).transpose(Image.FLIP_LEFT_RIGHT) img = Image.new("RGBA", (24,24), (38,92,255,0)) - + composite.alpha_over(img, side1, (0,6), side1) composite.alpha_over(img, side2, (12,6), side2) composite.alpha_over(img, top, (0,0), top) return (img.convert("RGB"), img.split()[3]) + if blockID == 23: # dispenser + top = transform_image(terrain_images[62]) + side1 = transform_image_side(terrain_images[46]) + side2 = transform_image_side(terrain_images[45]).transpose(Image.FLIP_LEFT_RIGHT) + + img = Image.new("RGBA", (24,24), (38,92,255,0)) + + composite.alpha_over(img, side1, (0,6), side1) + composite.alpha_over(img, side2, (12,6), side2) + composite.alpha_over(img, top, (0,0), top) + return (img.convert("RGB"), img.split()[3]) + + + if blockID == 65: # ladder raw_texture = terrain_images[83] #print "ladder is facing: %d" % data @@ -569,7 +583,22 @@ def generate_special_texture(blockID, data): composite.alpha_over(img, side2, (12,6), side2) composite.alpha_over(img, top, (0,0), top) return (img.convert("RGB"), img.split()[3]) - + + if blockID == 17: # wood: normal, birch and pines + top = terrain_images[21] + if data == 0: + side = terrain_images[20] + img = _build_block(top, side, 17) + return (img.convert("RGB"), img.split()[3]) + if data == 1: + side = terrain_images[116] + img = _build_block(top, side, 17) + return (img.convert("RGB"), img.split()[3]) + if data == 2: + side = terrain_images[117] + img = _build_block(top, side, 17) + return (img.convert("RGB"), img.split()[3]) + if blockID == 85: # fences # create needed images for Big stick fence raw_texture = terrain_images[4] @@ -853,21 +882,23 @@ 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]) +special_blocks = set([66,59,61,62, 65,64,71,91,86,2,18,85,17,23]) # this is a map of special blockIDs to a list of all # possible values for ancillary data that it might have. special_map = {} special_map[66] = range(10) # minecrart tracks special_map[59] = range(8) # crops -special_map[61] = (0,) # furnace -special_map[62] = (0,) # burning furnace +special_map[61] = range(6) # furnace +special_map[62] = range(6) # burning furnace special_map[65] = (2,3,4,5) # ladder special_map[64] = range(16) # wooden door special_map[71] = range(16) # iron door special_map[91] = range(5) # jack-o-lantern special_map[86] = range(5) # pumpkin special_map[85] = range(17) # fences +special_map[17] = range(4) # wood: normal, birch and pine +special_map[23] = range(6) # dispensers # 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 # like torches From 13f37734f43c86cc37b882858fbdd7a49800c909 Mon Sep 17 00:00:00 2001 From: Alejandro Aguilera Date: Sat, 15 Jan 2011 23:35:31 +0100 Subject: [PATCH 6/9] Add support for colored wool. --- textures.py | 80 +++++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 74 insertions(+), 6 deletions(-) diff --git a/textures.py b/textures.py index 05b07a2..73759dc 100644 --- a/textures.py +++ b/textures.py @@ -279,7 +279,7 @@ def _build_blockimages(): # 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 34, -1, 52, 48, 49,160,144, -1,176, 74, -1, -1, -1, -1, -1, -1, # Cloths are left out, sandstone (it has top, side, and bottom wich is ignored here), note block # 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 - -1, -1, -1, 64, 64, 13, 12, 29, 28, 23, 22, 6, 6, 7, 8, 35, # Gold/iron blocks? Doublestep? TNT from above? + -1, -1, -1, -1, -1, 13, 12, 29, 28, 23, 22, 6, 6, 7, 8, 35, # Gold/iron blocks? Doublestep? TNT from above? # 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 36, 37, 80, -1, 65, 4, 25,101, 98, 24, 43, -1, 86, -1, -1, -1, # Torch from above? leaving out fire. Redstone wire? Crops/furnaces handled elsewhere. sign post # 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 @@ -296,7 +296,7 @@ def _build_blockimages(): # 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 34, -1, 52, 48, 49,160,144, -1,192, 74, -1, -1,- 1, -1, -1, -1, # 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 - -1, -1, -1, 64, 64, 13, 12, 29, 28, 23, 22, 5, 5, 7, 8, 35, + -1, -1, -1, -1, -1, 13, 12, 29, 28, 23, 22, 5, 5, 7, 8, 35, # 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 36, 37, 80, -1, 65, 4, 25,101, 98, 24, 43, -1, 86, -1, -1, -1, # 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 @@ -599,6 +599,73 @@ def generate_special_texture(blockID, data): img = _build_block(top, side, 17) return (img.convert("RGB"), img.split()[3]) + if blockID == 35: # wool + if data == 0: # white + top = side = terrain_images[64] + img = _build_block(top, side, 35) + return (img.convert("RGB"), img.split()[3]) + if data == 1: # orange + top = side = terrain_images[210] + img = _build_block(top, side, 35) + return (img.convert("RGB"), img.split()[3]) + if data == 2: # magenta + top = side = terrain_images[194] + img = _build_block(top, side, 35) + return (img.convert("RGB"), img.split()[3]) + if data == 3: # light blue + top = side = terrain_images[178] + img = _build_block(top, side, 35) + return (img.convert("RGB"), img.split()[3]) + if data == 4: # yellow + top = side = terrain_images[162] + img = _build_block(top, side, 35) + return (img.convert("RGB"), img.split()[3]) + if data == 5: # light green + top = side = terrain_images[146] + img = _build_block(top, side, 35) + return (img.convert("RGB"), img.split()[3]) + if data == 6: # pink + top = side = terrain_images[130] + img = _build_block(top, side, 35) + return (img.convert("RGB"), img.split()[3]) + if data == 7: # grey + top = side = terrain_images[114] + img = _build_block(top, side, 35) + return (img.convert("RGB"), img.split()[3]) + if data == 8: # light grey + top = side = terrain_images[225] + img = _build_block(top, side, 35) + return (img.convert("RGB"), img.split()[3]) + if data == 9: # cyan + top = side = terrain_images[209] + img = _build_block(top, side, 35) + return (img.convert("RGB"), img.split()[3]) + if data == 10: # purple + top = side = terrain_images[193] + img = _build_block(top, side, 35) + return (img.convert("RGB"), img.split()[3]) + if data == 11: # blue + top = side = terrain_images[177] + img = _build_block(top, side, 35) + return (img.convert("RGB"), img.split()[3]) + if data == 12: # brown + top = side = terrain_images[161] + img = _build_block(top, side, 35) + return (img.convert("RGB"), img.split()[3]) + if data == 13: # dark green + top = side = terrain_images[145] + img = _build_block(top, side, 35) + return (img.convert("RGB"), img.split()[3]) + if data == 14: # red + top = side = terrain_images[129] + img = _build_block(top, side, 35) + return (img.convert("RGB"), img.split()[3]) + if data == 15: # black + top = side = terrain_images[113] + img = _build_block(top, side, 35) + return (img.convert("RGB"), img.split()[3]) + + if blockID == 85: # fences # create needed images for Big stick fence raw_texture = terrain_images[4] @@ -882,15 +949,15 @@ 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]) +special_blocks = set([66,59,61,62, 65,64,71,91,86,2,18,85,17,23,35]) # this is a map of special blockIDs to a list of all # possible values for ancillary data that it might have. special_map = {} special_map[66] = range(10) # minecrart tracks special_map[59] = range(8) # crops -special_map[61] = range(6) # furnace -special_map[62] = range(6) # burning furnace +special_map[61] = range(6) # furnace +special_map[62] = range(6) # burning furnace special_map[65] = (2,3,4,5) # ladder special_map[64] = range(16) # wooden door special_map[71] = range(16) # iron door @@ -898,7 +965,8 @@ special_map[91] = range(5) # jack-o-lantern special_map[86] = range(5) # pumpkin special_map[85] = range(17) # fences special_map[17] = range(4) # wood: normal, birch and pine -special_map[23] = range(6) # dispensers +special_map[23] = range(6) # dispensers +special_map[35] = range(16) # wool, colored and white # 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 # like torches From d93a0324ab0b3870005bdf346b062dfabd1af449 Mon Sep 17 00:00:00 2001 From: Alejandro Aguilera Date: Fri, 14 Jan 2011 00:29:42 +0100 Subject: [PATCH 7/9] Add fire texture. --- textures/fire.png | Bin 0 -> 563 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 textures/fire.png diff --git a/textures/fire.png b/textures/fire.png new file mode 100644 index 0000000000000000000000000000000000000000..7b28b6c4d115e0d814e182e22899e2c6837b0041 GIT binary patch literal 563 zcmeAS@N?(olHy`uVBq!ia0y~yU=RRd4mJh`2Kmqb6B!s77>k44ofy`glX=O&z`&N| z?e4;`mBE#PA>6dsfPsO5v%n*=n1O*?7=#%aX3ddcU|?V`@$_|Nzs<-at|+%A$=8s9 zfpN2^i(`nz>E22Evx5Ugj@zqyIyNbOTH?H|OQQWzLVLUSk)zf&w@m&wcx-RW`OCiK zAOE7+EO$dHB=)>uetBWx{x3Wgj>?gbhq85x@2P6$nazrTeH@GGUxl~E7V6x3#GP7e3n~G*UgN7<6 zt4hZg)_|>UeUlbVopV^w!0!>K!qS!=(@$JGo_S2YwIy(|bhqgvv8&!$^I0cuV-yWN zDs_|b-A=PUo9;yW&2Mra7z*r`m9b8mS5vmAc+u2ZHcWO*CwBj?S#jlwSO9axJCl!p zCfsdr<-UK{(vxL-YX0U4AIqMyZChXUY1&gi<6^mQrlnK1{j8H=-f&-U+5StP zou%$t{9VYvoqBM0T*8fTsk<{K?T*-Ed39C(nzJ|MWVQuOw7OieKlX@}qaXjZssCG^ zx6k}&WB=#zgZv+V_Dnxk8dZGGCDe5NtnIed?_KV$m?@YxeX4q_3Dbf6rArokFgvO8 Ri-CcG!PC{xWt~$(697s1>b?K~ literal 0 HcmV?d00001 From f866d5e654f1d1abe1fa2a8f29b1bd06b00819c3 Mon Sep 17 00:00:00 2001 From: Alejandro Aguilera Date: Mon, 17 Jan 2011 00:04:05 +0100 Subject: [PATCH 8/9] Add fire.png and a case for fire in textures.py. --- textures.py | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/textures.py b/textures.py index 73759dc..5efb889 100644 --- a/textures.py +++ b/textures.py @@ -571,6 +571,21 @@ def generate_special_texture(blockID, data): composite.alpha_over(img, top, (0,0), top) return (img.convert("RGB"), img.split()[3]) + if blockID == 51: # fire + firetexture = _load_image("fire.png") + side1 = transform_image_side(firetexture) + side2 = transform_image_side(firetexture).transpose(Image.FLIP_LEFT_RIGHT) + + img = Image.new("RGBA", (24,24), (38,92,255,0)) + + composite.alpha_over(img, side1, (12,0), side1) + composite.alpha_over(img, side2, (0,0), side2) + + composite.alpha_over(img, side1, (0,6), side1) + composite.alpha_over(img, side2, (12,6), side2) + + return (img.convert("RGB"), img.split()[3]) + if blockID == 18: # leaves t = tintTexture(terrain_images[52], (37, 118, 25)) top = transform_image(t) @@ -949,7 +964,8 @@ 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]) + +special_blocks = set([66,59,61,62, 65,64,71,91,86,2,18,85,17,23,35,51]) # this is a map of special blockIDs to a list of all # possible values for ancillary data that it might have. @@ -967,6 +983,8 @@ special_map[85] = range(17) # fences special_map[17] = range(4) # wood: normal, birch and pine special_map[23] = range(6) # dispensers special_map[35] = range(16) # wool, colored and white +special_map[51] = range(16) # fire + # 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 # like torches From 3db1953303d95cbf72f9bb1159dd5549d06f5fd8 Mon Sep 17 00:00:00 2001 From: Andrew Chin Date: Fri, 21 Jan 2011 21:11:39 -0500 Subject: [PATCH 9/9] a signGroup can now have an optional icon URL --- config.js | 4 +++- web_assets/functions.js | 4 ++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/config.js b/config.js index b339192..ac301cc 100644 --- a/config.js +++ b/config.js @@ -19,12 +19,14 @@ * * Optional: * checked : boolean. Set to true to have the group visible by default + * icon : string. Used to specify an icon url. */ var signGroups = [ // {label: "'To'", checked: false, match: function(s) {return s.msg.match(/to/)}}, // {label: "Storage", match: function(s) {return s.msg.match(/storage/i) || s.msg.match(/dirt/i) || s.msg.match(/sand/)}}, // {label: "Below Sealevel", match: function(s) { return s.y<64;}}, - {label: "All", match: function(s) {return true}} +// {label: "Info", match: function(s) { return s.msg.match("\\[info\\]");}, icon:"http://google-maps-icons.googlecode.com/files/info.png"}, + {label: "All", match: function(s) {return true}}, ]; /* mapTypeData -- a list of alternate map renderings available. At least one rendering must be diff --git a/web_assets/functions.js b/web_assets/functions.js index a80c758..ff8da92 100644 --- a/web_assets/functions.js +++ b/web_assets/functions.js @@ -184,6 +184,10 @@ function initMarkers() { if (item.type == 'sign') { iconURL = 'signpost_icon.png';} + console.log(signGroup.icon); + if (signGroup.icon) { iconURL = signGroup.icon; + } + var converted = fromWorldToLatLng(item.x, item.y, item.z); var marker = new google.maps.Marker({position: converted, map: map,