0

Updated findSigns.py & rerenderBlocks.py to work against region format

This commit is contained in:
Xon
2011-03-23 23:40:48 +08:00
parent c7920ce61e
commit e55b7045ea
3 changed files with 38 additions and 29 deletions

View File

@@ -7,8 +7,8 @@ blockID. The output is a chunklist file that is suitable to use with the
Example:
python contrib/rerenderBlocks.py --ids=46,79,91 --world=world/> chunklist.txt
python overviewer.py --chunklist=chunklist.txt world/ output_dir/
python contrib/rerenderBlocks.py --ids=46,79,91 --world=world/> regionlist.txt
python overviewer.py --regionlist=regionlist.txt world/ output_dir/
This will rerender any chunks that contain either TNT (46), Ice (79), or
a Jack-O-Lantern (91)
@@ -42,15 +42,20 @@ ids = map(lambda x: int(x),options.ids.split(","))
sys.stderr.write("Searching for these blocks: %r...\n" % ids)
matcher = re.compile(r"^c\..*\.dat$")
matcher = re.compile(r"^r\..*\.mcr$")
for dirpath, dirnames, filenames in os.walk(options.world):
for f in filenames:
if matcher.match(f):
full = os.path.join(dirpath, f)
blocks = get_blockarray_fromfile(full)
for i in ids:
if i in blocks:
print full
break
r = nbt.load_region(full)
chunks = r.get_chunks()
for x,y in chunks:
chunk = r.load_chunk(x,y).read_all()
blocks = get_blockarray(chunk[1]['Level'])
for i in ids:
if i in blocks:
print full
break