Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local xpApi = peripheral.wrap("right")
- local collectedXp
- while 1 do
- if redstone.getInput("top") == true then
- collectedXp = xpApi.collect()
- if collectedXp > 0 then
- print("Collected " .. collectedXp .. " XP. Current level is " .. xpApi.getLevels())
- end
- if xpApi.getLevels() >= 30 then
- for i = 1, 15, 1 do
- if turtle.getItemCount(i) > 0 then
- turtle.select(i)
- break
- elseif i == 15 then
- print("out of books!")
- end
- end
- turtle.transferTo(16, 1)
- turtle.select(16)
- xpApi.enchant(30)
- turtle.drop()
- print("Book enchanted..")
- end
- sleep(5)
- else
- sleep(10)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment