From 76d0d19de7b3ff1a25abb7d82d80cb87a548816e Mon Sep 17 00:00:00 2001 From: David Vierra Date: Mon, 15 Nov 2010 05:50:12 -1000 Subject: [PATCH] allow world to override chunk save, too --- mclevel.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/mclevel.py b/mclevel.py index ffe400a..dd2380d 100644 --- a/mclevel.py +++ b/mclevel.py @@ -1523,9 +1523,7 @@ class InfdevChunk(MCLevel): debug( u"No existing chunk file to rename" ) pass try: - chunkfh = file(self.filename, 'wb') - chunkfh.write(self.compressedTag) - chunkfh.close() + self.world._saveChunk(self, self.compressedTag) debug( u"Saved chunk {0}".format( self ) ) except IOError,e: @@ -2041,6 +2039,11 @@ class MCInfdevOldLevel(MCLevel): def _loadChunk(self, chunk): return file(chunk.filename, 'rb') + + def _saveChunk(self, chunk, data): + chunkfh = file(chunk.filename, 'wb') + chunkfh.write(data) + chunkfh.close() def discardAllChunks(self): """ clear lots of memory, fast. """