Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- exp = peripheral.wrap("right")
- exp.setAutoCollect(true)
- print("Enchanter & Grinder turtle is working!")
- chestDir = "dropDown" -- drop down into e.g. a chest
- function drop_all_items()
- for i = 1, 15 do
- if turtle.getItemCount(i)~=0 then
- turtle.select(i)
- turtle[chestDir]()
- end
- end
- turtle.select(1)
- end
- function enchantItem()
- if turtle.getItemCount( 16 ) >= 1 then -- any items in the 16 slot?
- if turtle.getItemCount( 15 ) ~= 0 then
- drop_all_items()
- end
- turtle.select( 16 ) -- select 16th slot
- turtle.transferTo(15, 1)
- turtle.select(15)
- exp.enchant( 30 ) -- enchant that item with level 30
- turtle[ chestDir ]() -- drop enchanted item
- turtle.select(1) -- select the 1st slot again
- else
- print("Error: Books / items to enchant are missing from slot #16!")
- end
- end
- while true do -- always run the lines below
- turtle.attack()
- if turtle.getItemCount( 1 ) > 0 then -- any items in the first slot?
- drop_all_items() -- it will drop items to the chest below
- end
- if exp.getLevels() >= 30 then -- internal EXP Level is 30 or above
- enchantItem() -- execute the fuction above
- end
- turtle.select(1)
- sleep(.2) -- we are performance-friendly, the turtle waits a bit
- end -- end of loop
Add Comment
Please, Sign In to add comment