Advertisement
Guest User

Untitled

a guest
May 1st, 2016
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.61 KB | None | 0 0
  1. local Blocks = {}
  2. Blocks["minecraft:lapis_block"] = {}
  3. Blocks["minecraft:lapis_block"][0] = "front"
  4. Blocks["minecraft:wool"] = {}
  5. --laine orange
  6. Blocks["minecraft:wool"][1] = "carrot"
  7. --laine bleue claire
  8. Blocks["minecraft:wool"][3] = "right"
  9. --laine marron
  10. Blocks["minecraft:wool"][12] = "left"
  11. --laine noire
  12. Blocks["minecraft:wool"][15] = "drop"
  13. --laine blanche
  14. Blocks["minecraft:wool"][0] = "load"
  15. Blocks["minecraft:coal_block"] = {}
  16. Blocks["minecraft:coal_block"][0] = "refuel"
  17.  
  18. function treatDirection(chain)
  19. if chain == "left" then
  20. turtle.turnLeft()
  21. elseif chain == "right" then
  22. turtle.turnRight()
  23. elseif chain == "carrot" then
  24. cropsAction()
  25. turtle.turnLeft()
  26. cropsAction()
  27. elseif chain == "refuel" then
  28. refuelAction()
  29. turtle.turnLeft()
  30. turtle.turnLeft()
  31. elseif chain == "drop" then
  32. turtle.select(2)
  33. turtle.drop(64)
  34. turtle.turnLeft()
  35. turtle.turnLeft()
  36. elseif chain == "load" then
  37. turtle.turnLeft()
  38. turtle.turnLeft()
  39. end
  40. turtle.forward()
  41. end
  42.  
  43. function refuelAction()
  44. turtle.select(1)
  45. turtle.suck(1)
  46. turtle.refuel()
  47. end
  48.  
  49. function checkDirection()
  50. find, res = turtle.inspectDown()
  51. print(find)
  52. print(Blocks[res.name])
  53. print(Blocks[res.name][res.metadata])
  54. if find and Blocks[res.name] and Blocks[res.name][res.metadata] then
  55. treatDirection(Blocks[res.name][res.metadata])
  56. else
  57. exit()
  58. end
  59. end
  60.  
  61. function cropsAction(type)
  62. turtle.turnLeft()
  63. test, datas = turtle.inspect()
  64. if datas.name == type and datas.metadata == 7 then
  65. turtle.select(2)
  66. turtle.dig()
  67. turtle.place()
  68. end
  69. end
  70.  
  71. while true do
  72. checkDirection()
  73. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement