Razara

enchanter

Feb 25th, 2013
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.80 KB | None | 0 0
  1. redstone.setOutput("bottom",true)
  2. xp = peripheral.wrap("right")
  3. term.clear()
  4. term.setCursorPos(1,1)
  5.  
  6. turtle.select(1)
  7. if turtle.getItemCount(1) == 0 then
  8.     print("Place books in the first slot")
  9. else
  10.    
  11.     write("Distributing books... ")
  12.     for i = 2,16 do
  13.         if turtle.getItemCount(i) == 0 then
  14.             turtle.transferTo(i,1)
  15.         end
  16.     end
  17.     print("Done")
  18.    
  19.     xp.setAutoCollect(true)
  20.     for i = 2,16 do
  21.         turtle.select(i)
  22.         term.setCursorPos(1,2)
  23.         term.clearLine()
  24.         print(string.format("Enchanting book %d ",i-1))
  25.            
  26.        
  27.         if turtle.getItemCount(i) > 0 then
  28.             while  not xp.enchant(30) do
  29.                 term.setCursorPos(1,3)
  30.                 term.clearLine()
  31.                 print(string.format("Current xp level: %d",xp.getLevels()))
  32.                 sleep(5)   
  33.             end        
  34.         end
  35.     end
  36.     xp.setAutoCollect(false)
  37. end
  38. redstone.setOutput("bottom",false)
Advertisement
Add Comment
Please, Sign In to add comment