Merge remote branch 'upstream/master'
This commit is contained in:
8
chunk.py
8
chunk.py
@@ -109,13 +109,13 @@ 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
|
||||
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])
|
||||
|
||||
@@ -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
|
||||
|
||||
9
setup.py
9
setup.py
@@ -4,6 +4,8 @@ from distutils.command.clean import clean
|
||||
from distutils.dir_util import remove_tree
|
||||
from distutils import log
|
||||
import os, os.path
|
||||
import glob
|
||||
import platform
|
||||
|
||||
try:
|
||||
import py2exe
|
||||
@@ -24,15 +26,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"] if platform.system() == "Windows" else []))
|
||||
# tell build_ext to build the extension in-place
|
||||
# (NOT in build/)
|
||||
setup_kwargs['options']['build_ext'] = {'inplace' : 1}
|
||||
|
||||
193
textures.py
193
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.
|
||||
@@ -261,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?
|
||||
-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
|
||||
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
|
||||
@@ -278,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,
|
||||
-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, 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
|
||||
@@ -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)
|
||||
@@ -383,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)
|
||||
|
||||
@@ -408,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
|
||||
@@ -509,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)
|
||||
@@ -521,7 +598,89 @@ 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 == 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]
|
||||
@@ -805,21 +964,27 @@ 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,35,51])
|
||||
|
||||
# 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
|
||||
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
|
||||
|
||||
BIN
textures/fire.png
Normal file
BIN
textures/fire.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 563 B |
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user