Skip to content

Instantly share code, notes, and snippets.

@Nessiesson
Created October 21, 2018 19:36
Show Gist options
  • Save Nessiesson/b552cf447d488d5ee0bb17f387d7b21b to your computer and use it in GitHub Desktop.
Save Nessiesson/b552cf447d488d5ee0bb17f387d7b21b to your computer and use it in GitHub Desktop.
import glob
import os
from nbt.region import RegionFile
world_name = '144_76_72_236'
entity_list = []
def main():
for file_name in glob.iglob(world_name + '/**/*.mca', recursive=True):
region = RegionFile(file_name)
poop = file_name.split(os.sep)[-3]
# noone cares about modded dimensions
if poop == 'DIM-1' or poop == 'DIM1':
dimension = poop
else:
dimension = 'DIM0'
for chunk in region.iter_chunks():
entities = chunk['Level']['Entities']
for entity in entities:
uuid = str(entity['UUIDLeast']) + str(entity['UUIDMost'])
if uuid in entity_list:
print('DUP: ' + str(entity['id']) + ' in ' + str(dimension) + ' at ' + str(entity['Pos']))
entity_list.append(uuid)
if __name__ == '__main__':
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment