daily pastebin goal
52%
SHARE
TWEET

Untitled

a guest Jan 13th, 2018 54 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import mcInterface
  2. from random import*
  3. #Made under python 3.2
  4. #Not compliant with 2.X versions
  5.  
  6. #The map must be square. Enter the side lenth of the map (not the max coodinates)
  7. #for exemple, for a map that goes from -500 to +500, the size is 1000
  8. MAPSIZE = 10000
  9.  
  10. #Enter the distance you want between each spawn points (in blocks)
  11. #Thiss distance will apply in each directions.
  12. BLOCKSBETWEENPOINTS = 1000
  13.  
  14. #the name of your world folder
  15. LOADNAME = 'world'
  16. WORLDNAME = 'world'
  17.  
  18. #the path where you want the spawn point files to be created.
  19. OUTPUTPATH = 'i:/bukettest/spawns/'
  20.  
  21. ### Do not edit from here unless you know what you do.
  22.  
  23. print("Importing the map")
  24. try:
  25.     the_map = mcInterface.SaveFile(LOADNAME)
  26.     print('the_map :', the_map)
  27. except IOError:
  28.     print('File name invalid or save file otherwise corrupted. Aborting')
  29. #assert isinstance(the_map, mcInterface.SaveFile)
  30.  
  31.  
  32. minsize = MAPSIZE - (MAPSIZE * 1.5) + (BLOCKSBETWEENPOINTS/2)
  33. x = minsize
  34. z = minsize
  35. maxsize=abs(x) - (BLOCKSBETWEENPOINTS/2)
  36. y_top = 128
  37. while z < maxsize:
  38.     while x < maxsize:
  39.         zrandom = z + choice(range(-200,200))
  40.         xrandom = x + choice(range(-200,200))
  41.         name = 'Name=x%sz%s\n' % (int(x) , int(z))
  42.         namefname = 'x%sz%s.cfg' % (int(x) , int(z))
  43.         fname = '%s%s.cfg' % (OUTPUTPATH, namefname)
  44.         name = name+'xpos=%s\n' % (int(x+xrandom))
  45.         name = name+'World=%s\n' % (WORLDNAME)
  46.         name = name+'Group=all\n'
  47.         name = name+'Message=none\n'
  48.         name = name+'zpos=%s\n' % (int(z+zrandom))
  49.         y_top = the_map.surface_block(int(x),int(z),'BD')
  50.         y = y_top['y']+1
  51.         name = name+'ypos=%s\n' % (int(y))
  52.         #name = name+'ypos=128'
  53.         zpos= 'zpos=%s\n' % (z)
  54.         f = open(fname,'w').close()
  55.         f = open(fname, 'a', encoding='utf-8')
  56.         f.write(name)
  57.         f.close()
  58.         x = x + BLOCKSBETWEENPOINTS
  59.         print('IN X x',x,' z',z)
  60.     x = minsize
  61.     z=z+BLOCKSBETWEENPOINTS
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top