inlined 'iterate_chunkblocks' (backported from Xon's code)
From the discussion in the massive Issue #271 discussion: https://github.com/brownan/Minecraft-Overviewer/issues/#issue/271
This commit is contained in:
24
chunk.py
24
chunk.py
@@ -97,21 +97,6 @@ def get_tileentity_data(level):
|
||||
data = level['TileEntities']
|
||||
return data
|
||||
|
||||
def iterate_chunkblocks(xoff,yoff):
|
||||
"""Iterates over the 16x16x128 blocks of a chunk in rendering order.
|
||||
Yields (x,y,z,imgx,imgy)
|
||||
x,y,z is the block coordinate in the chunk
|
||||
imgx,imgy is the image offset in the chunk image where that block should go
|
||||
"""
|
||||
for x in xrange(15,-1,-1):
|
||||
for y in xrange(16):
|
||||
imgx = xoff + x*12 + y*12
|
||||
imgy = yoff - x*6 + y*6 + 128*12 + 16*12//2
|
||||
for z in xrange(128):
|
||||
yield x,y,z,imgx,imgy
|
||||
imgy -= 12
|
||||
|
||||
|
||||
# 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])
|
||||
@@ -689,7 +674,14 @@ class ChunkRenderer(object):
|
||||
if not img:
|
||||
img = Image.new("RGBA", (384, 1728), (38,92,255,0))
|
||||
|
||||
for x,y,z,imgx,imgy in iterate_chunkblocks(xoff,yoff):
|
||||
for x in xrange(15,-1,-1):
|
||||
for y in xrange(16):
|
||||
imgx = xoff + x*12 + y*12
|
||||
imgy = yoff - x*6 + y*6 + 128*12 + 16*12//2
|
||||
imgy += 12
|
||||
for z in xrange(128):
|
||||
imgy -= 12
|
||||
|
||||
blockid = blocks[x,y,z]
|
||||
|
||||
# the following blocks don't have textures that can be pre-computed from the blockid
|
||||
|
||||
Reference in New Issue
Block a user