Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- print("How many garbage slots are you using?")
- local garbageSlots = read()
- print("You are using "..garbageSlots.." garbage slots")
- local enchantmentTable = peripheral.wrap("right")
- local levels=0
- function enchantBook()
- dumpLoot()
- turtle.turnRight()
- turtle.select(garbageSlots+1)
- turtle.suckDown()
- turtle.dropDown(turtle.getItemCount(garbageSlots+1)-1)
- enchantmentTable.enchant(30)
- print("Book Enchanted")
- turtle.drop()
- print("Levels Used: "..tonumber(levels) - tonumber(enchantmentTable.getLevels()))
- turtle.turnLeft()
- turtle.select(1)
- end
- function dumpGarbage()
- turtle.turnLeft()
- for i=1,garbageSlots do
- for j=garbageSlots+1,16 do
- turtle.select(j)
- if turtle.compareTo(i) then
- turtle.drop()
- end
- end
- turtle.select(i)
- turtle.drop(turtle.getItemCount(i)-1)
- end
- print("Garbage Dumped")
- turtle.turnRight()
- turtle.select(1)
- end
- function dumpLoot()
- dumpGarbage()
- turtle.turnRight()
- for i=garbageSlots+1,16 do
- turtle.select(i)
- turtle.drop()
- end
- print("Loot Dumped")
- turtle.turnLeft()
- turtle.select(1)
- end
- while true do
- turtle.attack()
- enchantmentTable.collect()
- if turtle.getItemCount(16) > 0 then
- dumpLoot()
- end
- if enchantmentTable.getLevels() > levels then
- print("Current Level: "..enchantmentTable.getLevels())
- end
- levels=enchantmentTable.getLevels()
- if levels > 29 then
- enchantBook()
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment