Advertisement
Guest User

Untitled

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