0

Fixed empty sign handling, updated findSigns.py

This commit is contained in:
Andrew Chin
2010-12-31 23:35:18 -05:00
parent 7b6bbbc267
commit 97aa81311c
2 changed files with 14 additions and 13 deletions

View File

@@ -906,15 +906,14 @@ class ChunkRenderer(object):
for entity in tileEntities: for entity in tileEntities:
if entity['id'] == 'Sign': if entity['id'] == 'Sign':
msg=' \n'.join([entity['Text1'], entity['Text2'], entity['Text3'], entity['Text4']]) msg=' \n'.join([entity['Text1'], entity['Text2'], entity['Text3'], entity['Text4']])
if not msg.strip(): if msg.strip():
# convert the blockID coordinates from local chunk # convert the blockID coordinates from local chunk
# coordinates to global world coordinates # coordinates to global world coordinates
newPOI = dict(type="sign", newPOI = dict(type="sign",
x= entity['x'], x= entity['x'],
y= entity['y'], y= entity['y'],
z= entity['z'], z= entity['z'],
msg="%s \n%s \n%s \n%s" % msg=msg,
(entity['Text1'], entity['Text2'], entity['Text3'], entity['Text4']),
chunk= (self.chunkX, self.chunkY), chunk= (self.chunkX, self.chunkY),
) )
self.queue.put(["newpoi", newPOI]) self.queue.put(["newpoi", newPOI])

View File

@@ -45,16 +45,18 @@ for dirpath, dirnames, filenames in os.walk(worlddir):
data = nbt.load(full)[1]['Level']['TileEntities'] data = nbt.load(full)[1]['Level']['TileEntities']
for entity in data: for entity in data:
if entity['id'] == 'Sign': if entity['id'] == 'Sign':
newPOI = dict(type="sign", msg=' \n'.join([entity['Text1'], entity['Text2'], entity['Text3'], entity['Text4']])
x= entity['x'], #print "checking -->%s<--" % msg.strip()
y= entity['y'], if msg.strip():
z= entity['z'], newPOI = dict(type="sign",
msg="%s \n%s \n%s \n%s" % x= entity['x'],
(entity['Text1'], entity['Text2'], entity['Text3'], entity['Text4']), y= entity['y'],
chunk= (entity['x']/16, entity['z']/16), z= entity['z'],
) msg=msg,
POI.append(newPOI) chunk= (entity['x']/16, entity['z']/16),
print "Found sign at (%d, %d, %d): %r" % (newPOI['x'], newPOI['y'], newPOI['z'], newPOI['msg']) )
POI.append(newPOI)
print "Found sign at (%d, %d, %d): %r" % (newPOI['x'], newPOI['y'], newPOI['z'], newPOI['msg'])