Created
July 1, 2014 08:13
-
-
Save 14mRh4X0r/aa5356544901bb44f490 to your computer and use it in GitHub Desktop.
Python script to fix Minecraft 14w26a/b snapshots. Needs https://github.com/mcedit/pymclevel to run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import os | |
import sys | |
if __name__ == "__main__": | |
# Unbuffer stdout | |
sys.stdout = os.fdopen(sys.stdout.fileno(), 'w', 0) | |
print "Loading world...", | |
from pymclevel import mclevel | |
level = mclevel.fromFile(sys.argv[1]) | |
print "done." | |
for dim in level.dimensions.values() + [level]: | |
chunkCoords = list(dim.allChunks) | |
i = 0 | |
total = len(chunkCoords) | |
fc = "Fixing chunks for %s..." % dim.displayName | |
print fc, | |
fci = len(fc) + 2 | |
for coord in chunkCoords: | |
chunk = dim.getChunk(*coord) | |
if i % 10 == 0: print "\033[%dG%0.2f%%" % (fci, float(i) / total * 100), | |
chunk.Blocks[:] = chunk.Blocks[:] & 255 | |
chunk.chunkChanged(False) | |
i += 1 | |
print "\033[%dG\033[Kdone." % fci | |
print "Saving world...", | |
level.saveInPlace() | |
print "done." | |
else: | |
raise ImportError, "Not meant to be imported" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment