Advertisement
Guest User

Untitled

a guest
Jun 23rd, 2018
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.99 KB | None | 0 0
  1. function reOrganiseInv()
  2. for i=3,16 do
  3. if turtle.getItemCount(i)==0 then
  4. if i+1<16
  5. turtle.select(i+1)
  6. turtle.transferTo(i)
  7. end
  8. else
  9. for o=i,16 do
  10. turtle.select(i)
  11. if turtle.compareTo(o) then
  12. turtle.select(o)
  13. turtle.transferTo(i)
  14. end
  15. end
  16. end
  17. end
  18. end
  19. function reFuel()
  20. if turtle.getFuelLevel() <= 200 then
  21. turtle.select(1)
  22. turtle.refuel(1)
  23. end
  24. end
  25. function remainingSlots()
  26. emptySlots =0
  27. for i=1,16 do
  28. if turtle.getItemCount(i)==0 then
  29. emptySlots=emptySlots+1
  30. end
  31. end
  32. return emptySlots
  33. end
  34. function backTrack()
  35. turtle.turnLeft()
  36. turtle.turnLeft()
  37. count =0
  38.  
  39. repeat
  40. count = count+1
  41. local success, data = turtle.forward()
  42. if success then
  43. end
  44. if count%5==0 then
  45. turtle.turnLeft()
  46. turtle.select(2)
  47. turtle.place()
  48. turtle.turnRight()
  49. turtle.select(1)
  50. end
  51. until not success
  52. end
  53. function clearSpace()
  54. turtle.turnLeft()
  55. turtle.turnLeft()
  56. dropCount=0
  57. for i=1,16 do
  58. local data = turtle.getItemDetail(i)
  59. if data then
  60. if data.name =="minecraft:cobblestone" then
  61. turtle.select(i)
  62. turtle.drop()
  63. dropCount=dropCount+1
  64. end
  65. end
  66. end
  67. if dropCount ==0 then
  68. backTrack()
  69. exit()
  70. end
  71. turtle.turnLeft()
  72. turtle.turnLeft()
  73. end
  74. function tunnelV2(x)
  75. for i = 1,x do
  76. turtle.dig()
  77. turtle.forward()
  78. turtle.digUp()
  79. turtle.turnLeft()
  80. turtle.dig()
  81. turtle.up()
  82. turtle.dig()
  83. turtle.turnRight()
  84. turtle.turnRight()
  85. turtle.dig()
  86. turtle.down()
  87. turtle.dig()
  88. turtle.turnLeft()
  89. reFuel()
  90. if remainingSlots()== 0 then
  91. clearSpace()
  92. end
  93. end
  94. backTrack()
  95. end
  96. local args={...}
  97. x=args[1]
  98. y=args[2]
  99. for i=1,y do
  100. turtle.dig()
  101. turtle.forward()
  102. turtle.digUp()
  103. if i%5==0 then
  104. print("i is : ",i)
  105. turtle.turnLeft()
  106. tunnelV2(x)
  107. turtle.turnLeft()
  108. end
  109. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement