Merge branch 'master' of git://github.com/brownan/Minecraft-Overviewer
This commit is contained in:
@@ -92,10 +92,10 @@ biome-accurate tinting, the Overviewer can use biome data produced by the
|
|||||||
Minecraft Biome Extractor tool. This tool can be downloaded from:
|
Minecraft Biome Extractor tool. This tool can be downloaded from:
|
||||||
http://www.minecraftforum.net/viewtopic.php?f=25&t=80902
|
http://www.minecraftforum.net/viewtopic.php?f=25&t=80902
|
||||||
|
|
||||||
If the EXTRACTEDBIOMES folder is present in the world directory, then the
|
If the "biomes" folder is present in the world directory, then the Overviewer
|
||||||
Overviewer will use the biome data to tint grass and leaves automatically --
|
will use the biome data to tint grass and leaves automatically -- there is no
|
||||||
there is no command line option to turn this feature on. If this folder does
|
command line option to turn this feature on. If this folder does not exist,
|
||||||
not exist, then the Overviewer will use a static tinting for grass and leaves.
|
then the Overviewer will use a static tinting for grass and leaves.
|
||||||
|
|
||||||
Compiling the C Extension (optional)
|
Compiling the C Extension (optional)
|
||||||
------------------------------------
|
------------------------------------
|
||||||
|
|||||||
13
chunk.py
13
chunk.py
@@ -675,9 +675,9 @@ class ChunkRenderer(object):
|
|||||||
if self.world.useBiomeData:
|
if self.world.useBiomeData:
|
||||||
biomeColorData = textures.getBiomeData(self.world.worlddir,
|
biomeColorData = textures.getBiomeData(self.world.worlddir,
|
||||||
self.chunkX, self.chunkY)
|
self.chunkX, self.chunkY)
|
||||||
# in the 8x8 block of biome data, what chunk is this?l
|
# in the 32x32 block of biome data, what chunk is this?l
|
||||||
startX = (self.chunkX - int(math.floor(self.chunkX/8)*8))
|
startX = self.chunkX % 32
|
||||||
startY = (self.chunkY - int(math.floor(self.chunkY/8)*8))
|
startY = self.chunkY % 32
|
||||||
|
|
||||||
# Each block is 24x24
|
# Each block is 24x24
|
||||||
# The next block on the X axis adds 12px to x and subtracts 6px from y in the image
|
# The next block on the X axis adds 12px to x and subtracts 6px from y in the image
|
||||||
@@ -717,14 +717,17 @@ class ChunkRenderer(object):
|
|||||||
continue
|
continue
|
||||||
|
|
||||||
if self.world.useBiomeData:
|
if self.world.useBiomeData:
|
||||||
|
# 16 : number of blocks in a chunk (in one direction)
|
||||||
|
# 32 : number of chunks in a region (and biome file) in one direction
|
||||||
|
# so 16 * 32 == 512 : number of blocks in biome file, in one direction
|
||||||
if blockid == 2: #grass
|
if blockid == 2: #grass
|
||||||
index = biomeColorData[ ((startY*16)+y) * 128 + (startX*16) + x]
|
index = biomeColorData[ ((startY*16)+y) * 512 + (startX*16) + x]
|
||||||
c = textures.grasscolor[index]
|
c = textures.grasscolor[index]
|
||||||
|
|
||||||
# only tint the top texture
|
# only tint the top texture
|
||||||
t = textures.prepareGrassTexture(c)
|
t = textures.prepareGrassTexture(c)
|
||||||
elif blockid == 18: # leaves
|
elif blockid == 18: # leaves
|
||||||
index = biomeColorData[ ((startY*16)+y) * 128 + (startX*16) + x]
|
index = biomeColorData[ ((startY*16)+y) * 512 + (startX*16) + x]
|
||||||
c = textures.foliagecolor[index]
|
c = textures.foliagecolor[index]
|
||||||
|
|
||||||
t = textures.prepareLeafTexture(c)
|
t = textures.prepareLeafTexture(c)
|
||||||
|
|||||||
2
gmap.py
2
gmap.py
@@ -139,7 +139,7 @@ def main():
|
|||||||
if not composite.extension_alpha_over:
|
if not composite.extension_alpha_over:
|
||||||
logging.info("Notice: alpha_over extension not found; using default PIL paste()")
|
logging.info("Notice: alpha_over extension not found; using default PIL paste()")
|
||||||
|
|
||||||
useBiomeData = os.path.exists(os.path.join(worlddir, 'EXTRACTEDBIOMES'))
|
useBiomeData = os.path.exists(os.path.join(worlddir, 'biomes'))
|
||||||
if not useBiomeData:
|
if not useBiomeData:
|
||||||
logging.info("Notice: Not using biome data for tinting")
|
logging.info("Notice: Not using biome data for tinting")
|
||||||
|
|
||||||
|
|||||||
15
textures.py
15
textures.py
@@ -283,7 +283,7 @@ def _build_blockimages():
|
|||||||
# 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
|
# 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
|
||||||
36, 37, 80, -1, 65, 4, 25, -1, 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, -1, 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
|
# 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
|
-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
|
# 80 81 82 83 84 85 86 87 88 89 90 91
|
||||||
66, 69, 72, 73, 74, -1,102,103,104,105,-1, 102 # clay?
|
66, 69, 72, 73, 74, -1,102,103,104,105,-1, 102 # clay?
|
||||||
]
|
]
|
||||||
@@ -300,7 +300,7 @@ def _build_blockimages():
|
|||||||
# 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
|
# 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,
|
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
|
# 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,
|
-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
|
# 80 81 82 83 84 85 86 87 88 89 90 91
|
||||||
66, 69, 72, 73, 74,-1 ,118,103,104,105, -1, 118
|
66, 69, 72, 73, 74,-1 ,118,103,104,105, -1, 118
|
||||||
]
|
]
|
||||||
@@ -824,9 +824,9 @@ def prepareBiomeData(worlddir):
|
|||||||
if grasscolor and foliagecolor:
|
if grasscolor and foliagecolor:
|
||||||
return
|
return
|
||||||
|
|
||||||
biomeDir = os.path.join(worlddir, "EXTRACTEDBIOMES")
|
biomeDir = os.path.join(worlddir, "biomes")
|
||||||
if not os.path.exists(biomeDir):
|
if not os.path.exists(biomeDir):
|
||||||
raise Exception("EXTRACTEDBIOMES not found")
|
raise Exception("biomes not found")
|
||||||
|
|
||||||
# try to find the biome color images. If _find_file can't locate them
|
# try to find the biome color images. If _find_file can't locate them
|
||||||
# then try looking in the EXTRACTEDBIOMES folder
|
# then try looking in the EXTRACTEDBIOMES folder
|
||||||
@@ -850,16 +850,13 @@ def getBiomeData(worlddir, chunkX, chunkY):
|
|||||||
|
|
||||||
global currentBiomeFile, currentBiomeData
|
global currentBiomeFile, currentBiomeData
|
||||||
|
|
||||||
biomeFile = "%d.%d.biome" % (
|
biomeFile = "b.%d.%d.biome" % (chunkX // 32, chunkY // 32)
|
||||||
int(math.floor(chunkX/8)*8),
|
|
||||||
int(math.floor(chunkY/8)*8)
|
|
||||||
)
|
|
||||||
if biomeFile == currentBiomeFile:
|
if biomeFile == currentBiomeFile:
|
||||||
return currentBiomeData
|
return currentBiomeData
|
||||||
|
|
||||||
currentBiomeFile = biomeFile
|
currentBiomeFile = biomeFile
|
||||||
|
|
||||||
f = open(os.path.join(worlddir, "EXTRACTEDBIOMES", biomeFile), "rb")
|
f = open(os.path.join(worlddir, "biomes", biomeFile), "rb")
|
||||||
rawdata = f.read()
|
rawdata = f.read()
|
||||||
f.close()
|
f.close()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user