Skip to content

Instantly share code, notes, and snippets.

@agrif
Created February 16, 2012 01:04
Show Gist options
  • Save agrif/1840477 to your computer and use it in GitHub Desktop.
Save agrif/1840477 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python
import redstone as rs
import sys
try:
biome = int(sys.argv[1])
files = sys.argv[2:]
except:
print "usage: {0} <biome> <region.mca ...>".format(sys.argv[0])
sys.exit(1)
for fname in files:
print "setting biome in", fname
r = rs.Region.open(fname, True)
for x in xrange(32):
for z in xrange(32):
if not r.contains_chunk(x, z):
continue
d = rs.NBT.parse_from_region(r, x, z)
biomes = d.find("Biomes")
biomes.value = chr(biome) * (16 * 16)
d.write_to_region(r, x, z)
r.flush()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment