def main(): options = parse_options(sys.argv[1:]) world = World(options.world) player = world.get_player(options.player) if not player: sys.stderr.write('No data found for the player\n') sys.exit(1) print world.get_region_filename(player.get_chunk_pos())
def main(): options = parse_options(sys.argv[1:]) world = World(options.world) if options.region_file: region = world.get_region(filename=options.region_file) else: player = world.get_player(options.player) if not player: sys.stderr.write('No data found for the player\n') sys.exit(1) region = world.get_region(pos=player.get_chunk_pos()) found_entities = [] for chunk in region.chunks: if chunk: nbt_data = chunk['nbt'] entities = nbt_data['Level']['Entities'] #print nbt_data.pretty_tree() for entity in entities.tags: if entity['id'].value == 2: print 'XXX' found_entities.append(entity) if 'Blocks' in nbt_data['Level']: blocks_data = nbt_data['Level']['Blocks'].value extra_data = nbt_data['Level']['Data'].value for i, block_id in enumerate(blocks_data): block_id = ord(block_id) # if i == 0 and ord(extra_data[i]) != 0: # AIR # print ord(extra_data[i]) # if block_id not in BLOCK_IDS: # print block_id #print BLOCK_IDS.get(block_id, 'Unknown (%s)' % block_id) return for entity in found_entities: entity_id = entity['id'].value if 'Item' in entity: item_id = entity['Item']['id'].value if 1 or item_id not in BLOCK_IDS: item_count = entity['Item']['Count'].value print '%s - %s - %s' % (entity_id, BLOCK_IDS.get(item_id, 'Unknown (%s)' % item_id), item_count)