|
@@ -184,8 +184,6 @@ def fillBlocks(self, box, blockType, blockData = 0): |
|
|
import traceback
|
|
|
|
|
|
log = getLogger(__name__)
|
|
|
-warn, error, info, debug = log.warn, log.error, log.info, log.debug
|
|
|
-
|
|
|
|
|
|
class LoadingError(RuntimeError):
|
|
|
pass
|
|
@@ -195,24 +193,24 @@ def fromFile(filename, loadInfinite=True): |
|
|
''' The preferred method for loading Minecraft levels of any type.
|
|
|
pass False to loadInfinite if you'd rather not load infdev levels.
|
|
|
'''
|
|
|
- info(u"Identifying " + filename)
|
|
|
+ log.info(u"Identifying " + filename)
|
|
|
|
|
|
if not filename:
|
|
|
raise IOError("File not found: " + filename)
|
|
|
if not os.path.exists(filename):
|
|
|
raise IOError("File not found: " + filename)
|
|
|
|
|
|
if ZipSchematic._isLevel(filename):
|
|
|
- info("Zipfile found, attempting zipped infinite level")
|
|
|
+ log.info("Zipfile found, attempting zipped infinite level")
|
|
|
lev = ZipSchematic(filename)
|
|
|
- info("Detected zipped Infdev level")
|
|
|
+ log.info("Detected zipped Infdev level")
|
|
|
return lev
|
|
|
|
|
|
if PocketWorld._isLevel(filename):
|
|
|
return PocketWorld(filename)
|
|
|
|
|
|
if MCInfdevOldLevel._isLevel(filename):
|
|
|
- info(u"Detected Infdev level.dat")
|
|
|
+ log.info(u"Detected Infdev level.dat")
|
|
|
if loadInfinite:
|
|
|
return MCInfdevOldLevel(filename=filename)
|
|
|
else:
|
|
@@ -232,7 +230,7 @@ def fromFile(filename, loadInfinite=True): |
|
|
raise ValueError("{0} contains only zeroes. This file is damaged beyond repair.")
|
|
|
|
|
|
if MCJavaLevel._isDataLevel(data):
|
|
|
- info(u"Detected Java-style level")
|
|
|
+ log.info(u"Detected Java-style level")
|
|
|
lev = MCJavaLevel(filename, data)
|
|
|
lev.compressed = False
|
|
|
return lev
|
|
@@ -243,15 +241,15 @@ def fromFile(filename, loadInfinite=True): |
|
|
try:
|
|
|
unzippedData = nbt.gunzip(rawdata)
|
|
|
except Exception, e:
|
|
|
- info(u"Exception during Gzip operation, assuming {0} uncompressed: {1!r}".format(filename, e))
|
|
|
+ log.info(u"Exception during Gzip operation, assuming {0} uncompressed: {1!r}".format(filename, e))
|
|
|
if unzippedData is None:
|
|
|
compressed = False
|
|
|
unzippedData = rawdata
|
|
|
|
|
|
#data =
|
|
|
data = unzippedData
|
|
|
if MCJavaLevel._isDataLevel(data):
|
|
|
- info(u"Detected compressed Java-style level")
|
|
|
+ log.info(u"Detected compressed Java-style level")
|
|
|
lev = MCJavaLevel(filename, data)
|
|
|
lev.compressed = compressed
|
|
|
return lev
|
|
@@ -260,9 +258,9 @@ def fromFile(filename, loadInfinite=True): |
|
|
root_tag = nbt.load(buf=data)
|
|
|
|
|
|
except Exception, e:
|
|
|
- info(u"Error during NBT load: {0!r}".format(e))
|
|
|
- info(traceback.format_exc())
|
|
|
- info(u"Fallback: Detected compressed flat block array, yzx ordered ")
|
|
|
+ log.info(u"Error during NBT load: {0!r}".format(e))
|
|
|
+ log.info(traceback.format_exc())
|
|
|
+ log.info(u"Fallback: Detected compressed flat block array, yzx ordered ")
|
|
|
try:
|
|
|
lev = MCJavaLevel(filename, data)
|
|
|
lev.compressed = compressed
|
|
@@ -272,14 +270,14 @@ def fromFile(filename, loadInfinite=True): |
|
|
|
|
|
else:
|
|
|
if MCIndevLevel._isTagLevel(root_tag):
|
|
|
- info(u"Detected Indev .mclevel")
|
|
|
+ log.info(u"Detected Indev .mclevel")
|
|
|
return MCIndevLevel(root_tag, filename)
|
|
|
if MCSchematic._isTagLevel(root_tag):
|
|
|
- info(u"Detected Schematic.")
|
|
|
+ log.info(u"Detected Schematic.")
|
|
|
return MCSchematic(root_tag=root_tag, filename=filename)
|
|
|
|
|
|
if INVEditChest._isTagLevel(root_tag):
|
|
|
- info(u"Detected INVEdit inventory file")
|
|
|
+ log.info(u"Detected INVEdit inventory file")
|
|
|
return INVEditChest(root_tag=root_tag, filename=filename)
|
|
|
|
|
|
raise IOError("Cannot detect file type.")
|
|
|
0 comments on commit
35bbbdc