Advertisement
Testman696969

Preparer

Dec 13th, 2019
499
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.69 KB | None | 0 0
  1. x,y,z=1,1,0
  2. dir=0
  3. count=turtle.getItemCount(1)
  4.  
  5. function Dig()
  6. local success,data=turtle.inspect()
  7. if success and not (data.name=="computercraft:turtle_expanded") then
  8. while turtle.detect() do
  9. turtle.dig()
  10. end
  11. end
  12. end
  13.  
  14. function DigUp()
  15. local success,data=turtle.inspectUp()
  16. if success and not (data.name=="computercraft:turtle_expanded") then
  17. turtle.digUp()
  18. end
  19. end
  20.  
  21. function DigDown()
  22. local success,data=turtle.inspectDown()
  23. if success then
  24. if data.name=="minecraft:bedrock" then return false
  25. elseif data.name=="computercraft:turtle_expanded" then
  26. else turtle.digDown()
  27. end
  28. end
  29. return true
  30. end
  31.  
  32. function Forward()
  33. while not turtle.forward() do
  34. Dig()
  35. turtle.attack()
  36. end
  37. if (dir%2)==0 then y=y+1-(dir%4)
  38. else x=x+2-(dir%4)
  39. end
  40. end
  41.  
  42. function Up()
  43. while not turtle.up() do
  44. DigUp()
  45. turtle.attackUp()
  46. end
  47. z=z+1
  48. end
  49.  
  50. function Down()
  51. while not turtle.down() do
  52. DigDown()
  53. turtle.attackDown()
  54. end
  55. z=z-1
  56. end
  57.  
  58. function Right()
  59. turtle.turnRight()
  60. dir=(dir-1)%4
  61. end
  62.  
  63. function Left()
  64. turtle.turnLeft()
  65. dir=(dir+1)%4
  66. end
  67.  
  68. function SelectCobble()
  69. for i=1,16 do
  70. local data=turtle.getItemDetail(i)
  71. if data and data.name=="minecraft:cobblestone" then
  72. turtle.select(i)
  73. break
  74. end
  75. end
  76. end
  77.  
  78. if count>0 then
  79. turtle.select(1)
  80. DigDown() Down()
  81. DigDown() Down()
  82. DigDown()
  83. Left()
  84. for i=1,3*count do
  85. if (x%3)==0 then
  86. DigUp() turtle.placeUp()
  87. end
  88. Dig() Forward() DigDown()
  89. end
  90. DigUp() Up() DigUp() Up() DigUp() Up()
  91. Right() Dig() Forward() Right()
  92. while x>1 do
  93. DigUp()
  94. SelectCobble() turtle.placeUp()
  95. Dig() Forward()
  96. end
  97. SelectCobble() turtle.placeUp()
  98. Left()
  99. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement