Advertisement
Guest User

Untitled

a guest
May 25th, 2019
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.53 KB | None | 0 0
  1. function selectStoneBrick()
  2. currentSelectedBlock = turtle.getItemDetail()
  3. if currentSelectedBlock ~= nil then
  4. for i = 1,16 do
  5. iBlockDetail = turtle.getItemDetail(i)
  6. if iBlockDetail ~= nil then
  7. if iBlockDetail.name == "minecraft:stonebrick" then
  8. break
  9. end
  10. end
  11. if i == 16 then
  12. error("oh noes stone brick ran out")
  13. end
  14. end
  15. end
  16. end
  17.  
  18. function forwardDig()
  19. blockInFront, blockInspect = turtle.inspect()
  20. if blockInFront then
  21. turtle.dig()
  22. end
  23. turtle.forward()
  24. end
  25.  
  26. function downDig()
  27. blockDown, blockInspect = turtle.inspectDown()
  28. if blockDown then
  29. turtle.digDown()
  30. end
  31. turtle.down()
  32. end
  33.  
  34. function upDig()
  35. blockUp, blockInspect = turtle.inspectUp()
  36. if blockUp then
  37. turtle.digUp()
  38. end
  39. end
  40.  
  41. function clearSpace()
  42. turtle.turnRight()
  43. for i = 1, 3 do
  44. upDig()
  45. end
  46. for i = 1, 5 do
  47. for j = 1, 6 do
  48. forwardDig()
  49. end
  50. turtle.turnRight(2)
  51. downDig()
  52. end
  53. end
  54.  
  55. function buildNextBitOfBridge()
  56. clearSpace()
  57. end
  58.  
  59. function checkFuel()
  60. fuelLevel = turtle.getFuelLevel()
  61. if fuelLevel < 50 then
  62. for i = 1, 16 do
  63. turtle.select(i)
  64. turtle.refuel(64)
  65. end
  66. end
  67. end
  68.  
  69. function mainLoop()
  70. while true do
  71. checkFuel()
  72. buildNextBitOfBridge()
  73. end
  74. end
  75.  
  76. mainLoop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement