tuekats

craft

Feb 6th, 2016
33
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.09 KB | None | 0 0
  1. local itemCount = 1
  2. local input = ...
  3. itemCount = input
  4.  
  5. function goHome()
  6. local condition = true
  7. local success1,reading1
  8. while condition do
  9. success1,reading1 = turtle.inspectUp()
  10. if success1 and reading1["name"]=="EnderStorage:enderChest" then
  11. condition = false
  12. else
  13. turtle.back()
  14. end
  15. end
  16. end
  17.  
  18. function empty()
  19. for j=1,16 do
  20. turtle.select(j)
  21. turtle.dropDown()
  22. end
  23. end
  24.  
  25. function refill()
  26. while turtle.getFuelLevel() < 10000 do
  27. turtle.select(1)
  28. turtle.suckUp(1)
  29. turtle.refuel()
  30. end
  31. end
  32.  
  33. function pulse()
  34. redstone.setOutput("right",true)
  35. sleep(1)
  36. redstone.setOutput("right",false)
  37. sleep(1)
  38. end
  39.  
  40. local slots = {1,2,3,5,6,7,9,10,11}
  41. local i = 1
  42. while i <= itemCount do
  43. goHome()
  44. empty()
  45. refill()
  46. print("run: "..i)
  47. for key,value in ipairs(slots) do
  48. turtle.forward()
  49. local success,reading = turtle.inspectUp()
  50. if success then
  51. turtle.select(value)
  52. while turtle.getItemCount(value) == 0 do
  53. pulse()
  54. sleep(1)
  55. turtle.suckDown(1)
  56. end
  57. end
  58. end
  59. turtle.forward()
  60. turtle.craft()
  61. empty()
  62. i=i+1
  63. end
Add Comment
Please, Sign In to add comment