Advertisement
Guest User

Untitled

a guest
May 25th, 2019
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.60 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 clearSpace()
  43. turtle.turnRight()
  44. for i = 1, 3 do
  45. upDig()
  46. end
  47. for i = 1, 6 do
  48. for j = 1, 6 do
  49. forwardDig()
  50. end
  51. for j = 1, 2 do
  52. turtle.turnRight()
  53. end
  54. downDig()
  55. end
  56. end
  57.  
  58. function buildNextBitOfBridge()
  59. clearSpace()
  60. end
  61.  
  62. function checkFuel()
  63. fuelLevel = turtle.getFuelLevel()
  64. if fuelLevel < 50 then
  65. for i = 1, 16 do
  66. turtle.select(i)
  67. turtle.refuel(64)
  68. end
  69. end
  70. end
  71.  
  72. function mainLoop()
  73. while true do
  74. checkFuel()
  75. buildNextBitOfBridge()
  76. return
  77. end
  78. end
  79.  
  80. mainLoop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement