Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- xp = peripheral.wrap("left")
- xp.setAutoCollect(true)
- term.clear()
- elvl = 30
- turtle.select(1)
- n = 1
- function swrite(str,x,y)
- term.setCursorPos(x,y)
- term.write(str)
- end
- function swritecenter(str,y)
- term.setCursorPos(w/2 - #str/2,y)
- term.write(str)
- end
- function cline(y)
- term.setCursorPos(1,y)
- term.clearLine()
- end
- function getBook()
- first = true
- turtle.select(1)
- turtle.suckDown()
- while turtle.getItemCount(1) == 0 do
- if first then
- cline(2)
- swrite("Ran out of books.",1,2)
- first = false
- end
- os.sleep(3)
- turtle.suckDown()
- end
- if turtle.getItemCount(1) > 1 then
- turtle.transferTo(2,turtle.getItemCount(1)-1)
- turtle.select(2)
- turtle.dropDown()
- turtle.select(1)
- end
- end
- while true do
- os.sleep(3)
- if xp.getLevels() >= 30 then
- getBook()
- xp.enchant(elvl)
- turtle.drop()
- cline(2)
- swrite("Enchanted book #"..n,1,2)
- n = n + 1
- end
- cline(1)
- swrite("Enchanting lvl 30 books. CLvl: "..xp.getLevels(),1,1)
- end
Advertisement
Add Comment
Please, Sign In to add comment