Advertisement
Guest User

Untitled

a guest
May 25th, 2019
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.20 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. turtle.up()
  40. end
  41.  
  42. function placeBridgeChunk()
  43. turtle.forward()
  44. turtle.turnRight()
  45. for i = 1, 2 do
  46. turtle.up()
  47. end
  48. selectStoneBrick()
  49. turtle.place()
  50. turtle.down()
  51. turtle.place()
  52. turtle.down()
  53. turtle.turnLeft()
  54. for i = 1, 7 do
  55. turtle.turnRight()
  56. turtle.place()
  57. turtle.turnLeft()
  58. turtle.forward()
  59. end
  60. turtle.down()
  61. for i = 1, 2 do
  62. turtle.turnRight()
  63. end
  64. turtle.forward()
  65.  
  66. end
  67.  
  68. function clearSpace()
  69. turtle.turnRight()
  70. for i = 1, 3 do
  71. upDig()
  72. end
  73. for i = 1, 6 do
  74. for j = 1, 6 do
  75. forwardDig()
  76. end
  77. for j = 1, 2 do
  78. turtle.turnRight()
  79. end
  80. downDig()
  81. end
  82. for i = 1, 3 do
  83. turtle.up()
  84. end
  85. turtle.turnLeft()
  86. end
  87.  
  88. function buildChunkOfBridge()
  89. forwardDig()
  90. clearSpace()
  91. placeBridgeChunk()
  92. end
  93.  
  94. function checkFuel()
  95. fuelLevel = turtle.getFuelLevel()
  96. if fuelLevel < 50 then
  97. for i = 1, 16 do
  98. turtle.select(i)
  99. turtle.refuel(64)
  100. end
  101. end
  102. end
  103.  
  104. function mainLoop()
  105. while true do
  106. checkFuel()
  107. buildChunkOfBridge()
  108. return
  109. end
  110. end
  111.  
  112. mainLoop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement