Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Wraps the enchanting peripheral on the right side
- m = peripheral.wrap("right")
- --Sets the automatic XP collection to true
- m.setAutoCollect(true)
- --Sets some variables
- --Variable named level
- level = 0
- --Variable named books based of the number of items in slot
- books = turtle.getItemCount(1)
- --Sets the variable level to the amount of levels the turtle has
- level = m.getLevels()
- --The code to enchant a book if the variable level is higher as 30
- if level > 30 then
- turtle.select(1)
- print("level is higher as 30")
- if (books > 1) then
- turtle.transferTo(2, books - 1)
- end
- m.enchant(30)
- turtle.drop()
- if (books > 1) then
- turtle.select(2)
- turtle.transferTo(1, books - 1)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment