Merge remote branch 'upstream/master'
This commit is contained in:
26
chunk.py
26
chunk.py
@@ -211,6 +211,8 @@ class ChunkRenderer(object):
|
|||||||
|
|
||||||
|
|
||||||
if self.world.useBiomeData:
|
if self.world.useBiomeData:
|
||||||
|
# make sure we've at least *tried* to load the color arrays in this process...
|
||||||
|
textures.prepareBiomeData(self.world.worlddir)
|
||||||
if not textures.grasscolor or not textures.foliagecolor:
|
if not textures.grasscolor or not textures.foliagecolor:
|
||||||
raise Exception("Can't find grasscolor.png or foliagecolor.png")
|
raise Exception("Can't find grasscolor.png or foliagecolor.png")
|
||||||
|
|
||||||
@@ -905,18 +907,18 @@ class ChunkRenderer(object):
|
|||||||
|
|
||||||
for entity in tileEntities:
|
for entity in tileEntities:
|
||||||
if entity['id'] == 'Sign':
|
if entity['id'] == 'Sign':
|
||||||
|
msg=' \n'.join([entity['Text1'], entity['Text2'], entity['Text3'], entity['Text4']])
|
||||||
# convert the blockID coordinates from local chunk
|
if msg.strip():
|
||||||
# coordinates to global world coordinates
|
# convert the blockID coordinates from local chunk
|
||||||
newPOI = dict(type="sign",
|
# coordinates to global world coordinates
|
||||||
x= entity['x'],
|
newPOI = dict(type="sign",
|
||||||
y= entity['y'],
|
x= entity['x'],
|
||||||
z= entity['z'],
|
y= entity['y'],
|
||||||
msg="%s \n%s \n%s \n%s" %
|
z= entity['z'],
|
||||||
(entity['Text1'], entity['Text2'], entity['Text3'], entity['Text4']),
|
msg=msg,
|
||||||
chunk= (self.chunkX, self.chunkY),
|
chunk= (self.chunkX, self.chunkY),
|
||||||
)
|
)
|
||||||
self.queue.put(["newpoi", newPOI])
|
self.queue.put(["newpoi", newPOI])
|
||||||
|
|
||||||
|
|
||||||
# check to see if there are any signs in the persistentData list that are from this chunk.
|
# check to see if there are any signs in the persistentData list that are from this chunk.
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ try:
|
|||||||
from _composite import alpha_over as _extension_alpha_over
|
from _composite import alpha_over as _extension_alpha_over
|
||||||
extension_alpha_over = _extension_alpha_over
|
extension_alpha_over = _extension_alpha_over
|
||||||
except ImportError:
|
except ImportError:
|
||||||
logging.warning("alpha_over extension not found; using default PIL paste()")
|
pass
|
||||||
|
|
||||||
def alpha_over(dest, src, pos_or_rect=(0, 0), mask=None):
|
def alpha_over(dest, src, pos_or_rect=(0, 0), mask=None):
|
||||||
"""Composite src over dest, using mask as the alpha channel (if
|
"""Composite src over dest, using mask as the alpha channel (if
|
||||||
|
|||||||
@@ -45,16 +45,18 @@ for dirpath, dirnames, filenames in os.walk(worlddir):
|
|||||||
data = nbt.load(full)[1]['Level']['TileEntities']
|
data = nbt.load(full)[1]['Level']['TileEntities']
|
||||||
for entity in data:
|
for entity in data:
|
||||||
if entity['id'] == 'Sign':
|
if entity['id'] == 'Sign':
|
||||||
newPOI = dict(type="sign",
|
msg=' \n'.join([entity['Text1'], entity['Text2'], entity['Text3'], entity['Text4']])
|
||||||
x= entity['x'],
|
#print "checking -->%s<--" % msg.strip()
|
||||||
y= entity['y'],
|
if msg.strip():
|
||||||
z= entity['z'],
|
newPOI = dict(type="sign",
|
||||||
msg="%s \n%s \n%s \n%s" %
|
x= entity['x'],
|
||||||
(entity['Text1'], entity['Text2'], entity['Text3'], entity['Text4']),
|
y= entity['y'],
|
||||||
chunk= (entity['x']/16, entity['z']/16),
|
z= entity['z'],
|
||||||
)
|
msg=msg,
|
||||||
POI.append(newPOI)
|
chunk= (entity['x']/16, entity['z']/16),
|
||||||
print "Found sign at (%d, %d, %d): %r" % (newPOI['x'], newPOI['y'], newPOI['z'], newPOI['msg'])
|
)
|
||||||
|
POI.append(newPOI)
|
||||||
|
print "Found sign at (%d, %d, %d): %r" % (newPOI['x'], newPOI['y'], newPOI['z'], newPOI['msg'])
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
3
gmap.py
3
gmap.py
@@ -28,6 +28,7 @@ import multiprocessing
|
|||||||
import time
|
import time
|
||||||
import logging
|
import logging
|
||||||
import optimizeimages
|
import optimizeimages
|
||||||
|
import composite
|
||||||
|
|
||||||
logging.basicConfig(level=logging.INFO,format="%(asctime)s [%(levelname)s] %(message)s")
|
logging.basicConfig(level=logging.INFO,format="%(asctime)s [%(levelname)s] %(message)s")
|
||||||
|
|
||||||
@@ -123,6 +124,8 @@ def main():
|
|||||||
logging.info("Welcome to Minecraft Overviewer!")
|
logging.info("Welcome to Minecraft Overviewer!")
|
||||||
logging.debug("Current log level: {0}".format(logging.getLogger().level))
|
logging.debug("Current log level: {0}".format(logging.getLogger().level))
|
||||||
|
|
||||||
|
if not composite.extension_alpha_over:
|
||||||
|
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, 'EXTRACTEDBIOMES'))
|
||||||
if not useBiomeData:
|
if not useBiomeData:
|
||||||
|
|||||||
32
textures.py
32
textures.py
@@ -749,42 +749,50 @@ def prepareLeafTexture(color):
|
|||||||
|
|
||||||
currentBiomeFile = None
|
currentBiomeFile = None
|
||||||
currentBiomeData = None
|
currentBiomeData = None
|
||||||
|
grasscolor = None
|
||||||
|
foliagecolor = None
|
||||||
|
|
||||||
def prepareBiomeData(worlddir):
|
def prepareBiomeData(worlddir):
|
||||||
|
global grasscolor, foliagecolor
|
||||||
|
|
||||||
|
# skip if the color files are already loaded
|
||||||
|
if grasscolor and foliagecolor:
|
||||||
|
return
|
||||||
|
|
||||||
biomeDir = os.path.join(worlddir, "EXTRACTEDBIOMES")
|
biomeDir = os.path.join(worlddir, "EXTRACTEDBIOMES")
|
||||||
if not os.path.exists(biomeDir):
|
if not os.path.exists(biomeDir):
|
||||||
raise Exception("EXTRACTEDBIOMES not found")
|
raise Exception("EXTRACTEDBIOMES not found")
|
||||||
|
|
||||||
t = sys.modules[__name__]
|
|
||||||
|
|
||||||
# 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
|
||||||
try:
|
try:
|
||||||
t.grasscolor = list(Image.open(_find_file("grasscolor.png")).getdata())
|
grasscolor = list(Image.open(_find_file("grasscolor.png")).getdata())
|
||||||
t.foliagecolor = list(Image.open(_find_file("foliagecolor.png")).getdata())
|
foliagecolor = list(Image.open(_find_file("foliagecolor.png")).getdata())
|
||||||
except IOError:
|
except IOError:
|
||||||
try:
|
try:
|
||||||
t.grasscolor = list(Image.open(os.path.join(biomeDir,"grasscolor.png")).getdata())
|
grasscolor = list(Image.open(os.path.join(biomeDir,"grasscolor.png")).getdata())
|
||||||
t.foliagecolor = list(Image.open(os.path.join(biomeDir,"foliagecolor.png")).getdata())
|
foliagecolor = list(Image.open(os.path.join(biomeDir,"foliagecolor.png")).getdata())
|
||||||
except:
|
except:
|
||||||
t.grasscolor = None
|
# clear anything that managed to get set
|
||||||
t.foliagecolor = None
|
grasscolor = None
|
||||||
|
foliagecolor = None
|
||||||
|
|
||||||
def getBiomeData(worlddir, chunkX, chunkY):
|
def getBiomeData(worlddir, chunkX, chunkY):
|
||||||
'''Opens the worlddir and reads in the biome color information
|
'''Opens the worlddir and reads in the biome color information
|
||||||
from the .biome files. See also:
|
from the .biome files. See also:
|
||||||
http://www.minecraftforum.net/viewtopic.php?f=25&t=80902
|
http://www.minecraftforum.net/viewtopic.php?f=25&t=80902
|
||||||
'''
|
'''
|
||||||
t = sys.modules[__name__]
|
|
||||||
|
global currentBiomeFile, currentBiomeData
|
||||||
|
|
||||||
biomeFile = "%d.%d.biome" % (
|
biomeFile = "%d.%d.biome" % (
|
||||||
int(math.floor(chunkX/8)*8),
|
int(math.floor(chunkX/8)*8),
|
||||||
int(math.floor(chunkY/8)*8)
|
int(math.floor(chunkY/8)*8)
|
||||||
)
|
)
|
||||||
if biomeFile == t.currentBiomeFile:
|
if biomeFile == currentBiomeFile:
|
||||||
return currentBiomeData
|
return currentBiomeData
|
||||||
|
|
||||||
t.currentBiomeFile = biomeFile
|
currentBiomeFile = biomeFile
|
||||||
|
|
||||||
f = open(os.path.join(worlddir, "EXTRACTEDBIOMES", biomeFile), "rb")
|
f = open(os.path.join(worlddir, "EXTRACTEDBIOMES", biomeFile), "rb")
|
||||||
rawdata = f.read()
|
rawdata = f.read()
|
||||||
@@ -792,7 +800,7 @@ def getBiomeData(worlddir, chunkX, chunkY):
|
|||||||
|
|
||||||
data = numpy.frombuffer(rawdata, dtype=numpy.dtype(">u2"))
|
data = numpy.frombuffer(rawdata, dtype=numpy.dtype(">u2"))
|
||||||
|
|
||||||
t.currentBiomeData = data
|
currentBiomeData = data
|
||||||
return data
|
return data
|
||||||
|
|
||||||
# This set holds block ids that require special pre-computing. These are typically
|
# This set holds block ids that require special pre-computing. These are typically
|
||||||
|
|||||||
3
world.py
3
world.py
@@ -222,7 +222,8 @@ class WorldRenderer(object):
|
|||||||
## find the first air block
|
## find the first air block
|
||||||
while (blockArray[inChunkX, inChunkZ, spawnY] != 0):
|
while (blockArray[inChunkX, inChunkZ, spawnY] != 0):
|
||||||
spawnY += 1
|
spawnY += 1
|
||||||
|
if spawnY == 128:
|
||||||
|
break
|
||||||
|
|
||||||
self.POI.append( dict(x=spawnX, y=spawnY, z=spawnZ,
|
self.POI.append( dict(x=spawnX, y=spawnY, z=spawnZ,
|
||||||
msg="Spawn", type="spawn", chunk=(inChunkX,inChunkZ)))
|
msg="Spawn", type="spawn", chunk=(inChunkX,inChunkZ)))
|
||||||
|
|||||||
Reference in New Issue
Block a user