added create command. creates a new level and loads it into the editor
This commit is contained in:
parent
914a3bda50
commit
cc41dfaada
29
mce.py
29
mce.py
@ -45,7 +45,8 @@ class mce(object):
|
|||||||
{commandPrefix}relight [ <box> ]
|
{commandPrefix}relight [ <box> ]
|
||||||
|
|
||||||
World commands:
|
World commands:
|
||||||
{commandPrefix}degrief
|
{commandPrefix}create <filename>
|
||||||
|
{commandPrefix}degrief
|
||||||
{commandPrefix}time [ <time> ]
|
{commandPrefix}time [ <time> ]
|
||||||
{commandPrefix}worldsize
|
{commandPrefix}worldsize
|
||||||
{commandPrefix}heightmap <filename>
|
{commandPrefix}heightmap <filename>
|
||||||
@ -94,6 +95,7 @@ class mce(object):
|
|||||||
"prune",
|
"prune",
|
||||||
"relight",
|
"relight",
|
||||||
|
|
||||||
|
"create",
|
||||||
"degrief",
|
"degrief",
|
||||||
"time",
|
"time",
|
||||||
"worldsize",
|
"worldsize",
|
||||||
@ -730,6 +732,31 @@ class mce(object):
|
|||||||
print "Relit 0 chunks."
|
print "Relit 0 chunks."
|
||||||
self.needsSave = True;
|
self.needsSave = True;
|
||||||
|
|
||||||
|
def _create(self, command):
|
||||||
|
"""
|
||||||
|
create <filename>
|
||||||
|
|
||||||
|
Create and load a new Minecraft Alpha world. This world will have no
|
||||||
|
chunks and a random terrain seed.
|
||||||
|
"""
|
||||||
|
if len(command) < 1:
|
||||||
|
raise UsageError, "Expected a filename"
|
||||||
|
|
||||||
|
filename = command[0];
|
||||||
|
if not os.path.exists(filename):
|
||||||
|
os.mkdir(filename);
|
||||||
|
|
||||||
|
if not os.path.isdir(filename):
|
||||||
|
raise IOError, "{0} already exists".format(filename)
|
||||||
|
|
||||||
|
if mclevel.MCInfdevOldLevel.isLevel(filename):
|
||||||
|
raise IOError, "{0} is already a Minecraft Alpha world".format(filename)
|
||||||
|
|
||||||
|
level = mclevel.MCInfdevOldLevel(filename, create = True);
|
||||||
|
|
||||||
|
self.level = level;
|
||||||
|
|
||||||
|
|
||||||
def _degrief(self, command):
|
def _degrief(self, command):
|
||||||
"""
|
"""
|
||||||
degrief [ <height> ]
|
degrief [ <height> ]
|
||||||
|
Reference in New Issue
Block a user