1. Andrew Godwin
  2. myne

Commits

Andrew Godwin  committed 670779c

Scripts to re-water a world

  • Participants
  • Parent commits 276d00d
  • Branches default

Comments (0)

Files changed (3)

File myne/fix-world.py

  • Ignore whitespace
-import gzip
-import sys
-import os
-
-if len(sys.argv) == 1:
-    print "Please provide a filename."
-
-filename = sys.argv[1]    
-    
-print "Fixing %s..." % filename
-
-gzf = gzip.GzipFile(filename)
-ngzf = gzip.GzipFile(filename + ".new", "wb")
-
-# Write the size header
-ngzf.write(gzf.read(4))
-
-# Write each byte, checking for out-of-range
-chunk = gzf.read(2048)
-while chunk:
-    ngzf.write("".join([("\0" if ord(byte) > 41 else byte) for byte in chunk]))
-    chunk = gzf.read(2048)
-
-gzf.close()
-ngzf.close()
-os.rename(filename+".new", filename)

File scripts/fix-world.py

View file
  • Ignore whitespace
+import gzip
+import sys
+import os
+
+if len(sys.argv) == 1:
+    print "Please provide a filename."
+
+filename = sys.argv[1]    
+    
+print "Fixing %s..." % filename
+
+gzf = gzip.GzipFile(filename)
+ngzf = gzip.GzipFile(filename + ".new", "wb")
+
+# Write the size header
+ngzf.write(gzf.read(4))
+
+# Write each byte, checking for out-of-range
+chunk = gzf.read(2048)
+while chunk:
+    ngzf.write("".join([("\0" if ord(byte) > 41 else byte) for byte in chunk]))
+    chunk = gzf.read(2048)
+
+gzf.close()
+ngzf.close()
+os.rename(filename+".new", filename)

File scripts/water-world.py

View file
  • Ignore whitespace
+import gzip
+import sys
+import os
+
+if len(sys.argv) == 1:
+    print "Please provide a filename."
+
+filename = sys.argv[1]    
+    
+print "Converting still water to normal water in %s..." % filename
+
+gzf = gzip.GzipFile(filename)
+ngzf = gzip.GzipFile(filename + ".new", "wb")
+
+# Write the size header
+ngzf.write(gzf.read(4))
+
+# Write each byte, checking for out-of-range
+chunk = gzf.read(2048)
+while chunk:
+    ngzf.write("".join([("\8" if ord(byte) == 9 else byte) for byte in chunk]))
+    chunk = gzf.read(2048)
+
+gzf.close()
+ngzf.close()
+os.rename(filename+".new", filename)