Archived
Create RegionSets via the World object
This commit is contained in:
@@ -263,10 +263,6 @@ class MultiWorldParser(object):
|
||||
|
||||
def validate(self):
|
||||
|
||||
# first validate the world dict
|
||||
for worldname in self.world:
|
||||
if not os.path.exists(self.world[worldname]):
|
||||
raise Exception("%r does not exist for %s" % (self.world[worldname], worldname))
|
||||
|
||||
origs = dict()
|
||||
|
||||
|
||||
@@ -18,6 +18,7 @@ from settingsValidators import *
|
||||
|
||||
render = {
|
||||
"worldname": dict(required=True, validator=validateWorldPath, save_orig=True),
|
||||
"dimension": dict(required=False, validator=validateDimension, default="default"),
|
||||
"title": dict(required=True, validator=validateStr),
|
||||
"rendermode": dict(required=False, validator=validateRenderMode),
|
||||
"northdirection": dict(required=False, validator=validateNorthDirection),
|
||||
|
||||
@@ -9,7 +9,10 @@ def validateWorldPath(name, **kwargs):
|
||||
world = kwargs.get('world', dict())
|
||||
if name not in world.keys():
|
||||
raise ValidationException("bad world name")
|
||||
return os.path.abspath(world[name])
|
||||
abs_path = os.path.abspath(world[name])
|
||||
if not os.path.exists(os.path.join(abs_path, "level.dat")):
|
||||
raise ValidationException("No level.dat file in %r. Check the path for world %r" % (abs_path, name))
|
||||
return abs_path
|
||||
|
||||
|
||||
def validateRenderMode(mode, **kwargs):
|
||||
@@ -94,3 +97,9 @@ def validateInt(i, **kwargs):
|
||||
|
||||
def validateStr(s, **kwargs):
|
||||
return str(s)
|
||||
|
||||
def validateDimension(d, **kwargs):
|
||||
if d in ["nether", "overworld", "end", "default"]:
|
||||
return d
|
||||
raise ValidationException("%r is not a valid dimension" % d)
|
||||
|
||||
|
||||
@@ -138,7 +138,7 @@ class World(object):
|
||||
mcrs = filter(lambda x: x.endswith(".mcr"), files)
|
||||
if mcrs:
|
||||
# construct a regionset object for this
|
||||
rset = RegionSet(self, root)
|
||||
rset = RegionSet(root)
|
||||
if root == os.path.join(self.worlddir, "region"):
|
||||
self.regionsets.insert(0, rset)
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user