Advertisement
klindley

lighter

Feb 2nd, 2015
199
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.86 KB | None | 0 0
  1. success = false
  2. triedTimes = 1
  3. turn = 1
  4. slot = 1
  5. turtle.select (slot)
  6. while triedTimes < 5 do
  7. t, b=turtle.inspectBlock ()
  8. if t and b.name=="minecraft:stone" then
  9. turtle.digDown ()
  10. turtle.placeDown ()
  11. else
  12. if turn == 1 then
  13. doTurnRight ()
  14. else
  15. doTurnLeft ()
  16. end
  17. repeat
  18. moveForward ()
  19. t, b=turtle.inspectDown()
  20. success = t and (b.name=="minecraft:stone")
  21. if not success then
  22. triedTimes = triedTimes + 1
  23. end
  24. until success or triedTimes == 5
  25. if turtle.getItemCount (slot) == 1 then
  26. turtle.select (slot = slot + 1)
  27. end
  28. end
  29.  
  30. function turnRight ()
  31. turtle.turnRight ()
  32. moveForward ()
  33. turtle.turnRight ()
  34. turn = 2
  35. end
  36.  
  37. function turnLeft ()
  38. turtle.turnLeft ()
  39. moveForward ()
  40. turtle.turnLeft()
  41. turn = 1
  42. end
  43.  
  44. function moveForward ()
  45. turtle.forward ()
  46. turtle.forward ()
  47. turtle.forward ()
  48. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement