Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import mcInterface
- from random import*
- #Made under python 3.2
- #Not compliant with 2.X versions
- #The map must be square. Enter the side lenth of the map (not the max coodinates)
- #for exemple, for a map that goes from -500 to +500, the size is 1000
- MAPSIZE = 10000
- #Enter the distance you want between each spawn points (in blocks)
- #Thiss distance will apply in each directions.
- BLOCKSBETWEENPOINTS = 1000
- #the name of your world folder
- LOADNAME = 'world'
- WORLDNAME = 'world'
- #the path where you want the spawn point files to be created.
- OUTPUTPATH = 'i:/bukettest/spawns/'
- ### Do not edit from here unless you know what you do.
- print("Importing the map")
- try:
- the_map = mcInterface.SaveFile(LOADNAME)
- print('the_map :', the_map)
- except IOError:
- print('File name invalid or save file otherwise corrupted. Aborting')
- #assert isinstance(the_map, mcInterface.SaveFile)
- minsize = MAPSIZE - (MAPSIZE * 1.5) + (BLOCKSBETWEENPOINTS/2)
- x = minsize
- z = minsize
- maxsize=abs(x) - (BLOCKSBETWEENPOINTS/2)
- y_top = 128
- while z < maxsize:
- while x < maxsize:
- zrandom = z + choice(range(-200,200))
- xrandom = x + choice(range(-200,200))
- name = 'Name=x%sz%s\n' % (int(x) , int(z))
- namefname = 'x%sz%s.cfg' % (int(x) , int(z))
- fname = '%s%s.cfg' % (OUTPUTPATH, namefname)
- name = name+'xpos=%s\n' % (int(x+xrandom))
- name = name+'World=%s\n' % (WORLDNAME)
- name = name+'Group=all\n'
- name = name+'Message=none\n'
- name = name+'zpos=%s\n' % (int(z+zrandom))
- y_top = the_map.surface_block(int(x),int(z),'BD')
- y = y_top['y']+1
- name = name+'ypos=%s\n' % (int(y))
- #name = name+'ypos=128'
- zpos= 'zpos=%s\n' % (z)
- f = open(fname,'w').close()
- f = open(fname, 'a', encoding='utf-8')
- f.write(name)
- f.close()
- x = x + BLOCKSBETWEENPOINTS
- print('IN X x',x,' z',z)
- x = minsize
- z=z+BLOCKSBETWEENPOINTS
Add Comment
Please, Sign In to add comment