don't recompute the directory name table every time
This commit is contained in:
parent
61ec62f9d2
commit
efe5fbabf8
13
mclevel.py
13
mclevel.py
@ -1842,9 +1842,6 @@ class MCInfdevOldLevel(MCLevel):
|
|||||||
info( "level.dat restored from backup." )
|
info( "level.dat restored from backup." )
|
||||||
self.saveInPlace();
|
self.saveInPlace();
|
||||||
|
|
||||||
self.dirhashes = [self.dirhash(n) for n in range(64)];
|
|
||||||
self.dirhash=self.dirhashlookup;
|
|
||||||
|
|
||||||
playerFilePath = os.path.join(self.worldDir, "players")
|
playerFilePath = os.path.join(self.worldDir, "players")
|
||||||
if os.path.isdir(playerFilePath):
|
if os.path.isdir(playerFilePath):
|
||||||
self.players = [x[:-4] for x in os.listdir(playerFilePath) if x.endswith(".dat")]
|
self.players = [x[:-4] for x in os.listdir(playerFilePath) if x.endswith(".dat")]
|
||||||
@ -1949,10 +1946,10 @@ class MCInfdevOldLevel(MCLevel):
|
|||||||
|
|
||||||
return neg + ''.join(reversed(work))
|
return neg + ''.join(reversed(work))
|
||||||
|
|
||||||
def dirhashlookup(self, n):
|
|
||||||
return self.dirhashes[n%64];
|
|
||||||
|
|
||||||
def dirhash(self, n):
|
def dirhash(self, n):
|
||||||
|
return self.dirhashes[n%64];
|
||||||
|
|
||||||
|
def _dirhash(n):
|
||||||
n=n%64;
|
n=n%64;
|
||||||
s=u"";
|
s=u"";
|
||||||
if(n>=36):
|
if(n>=36):
|
||||||
@ -1961,7 +1958,9 @@ class MCInfdevOldLevel(MCLevel):
|
|||||||
s+=u"0123456789abcdefghijklmnopqrstuvwxyz"[n]
|
s+=u"0123456789abcdefghijklmnopqrstuvwxyz"[n]
|
||||||
|
|
||||||
return s;
|
return s;
|
||||||
|
|
||||||
|
dirhashes = [_dirhash(n) for n in range(64)];
|
||||||
|
|
||||||
|
|
||||||
def chunkFilename(self, x, z):
|
def chunkFilename(self, x, z):
|
||||||
s= os.path.join(self.worldDir, self.dirhash(x), self.dirhash(z),
|
s= os.path.join(self.worldDir, self.dirhash(x), self.dirhash(z),
|
||||||
|
Reference in New Issue
Block a user