Advertisement
Guest User

ore

a guest
Jun 20th, 2019
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.41 KB | None | 0 0
  1. steps = 0
  2.  
  3. function goBack()
  4.    
  5.     turtle.turnRight()
  6.     turtle.turnRight()
  7.    
  8.     for i = 1,steps do
  9.         turtle.forward()
  10.        
  11.     end
  12.    
  13.     for i = 1,15 do
  14.        
  15.         turtle.select(i)
  16.         if turtle.compareTo(16) then
  17.             turtle.dropDown()
  18.         else
  19.             turtle.dropUp()
  20.        
  21.         end
  22.        
  23.    
  24.     end
  25.     for i = 1,turtle.getItemCount(16)-1 do
  26.         turtle.dropDown()
  27.     end
  28.    
  29.     turtle.turnRight()
  30.     turtle.turnRight()
  31.    
  32.     for i = 1,steps do
  33.         turtle.forward()
  34.     end
  35.    
  36. end
  37.  
  38.  
  39. function inventoryCheck()
  40.     space = 15
  41.     for i = 1,15 do
  42.         if turtle.getItemSpace(i) < 64 then
  43.             space = space - 1
  44.        
  45.         end
  46.            
  47.     end
  48.     if space == 0 then
  49.     return true
  50.     end
  51.     return false
  52. end
  53.  
  54. function miningSides()
  55.  
  56.  
  57.     if turtle.detect() then
  58.         while turtle.detect() do
  59.             turtle.dig()
  60.         end
  61.         turtle.forward()
  62.     else
  63.         turtle.forward()
  64.     end
  65.    
  66.     if not turtle.detect() then
  67.         turtle.select(16)
  68.         turtle.place()
  69.     end
  70.    
  71.    
  72.     if turtle.detectUp() then
  73.         while turtle.detectUp() do
  74.             turtle.digUp()
  75.         end
  76.         turtle.up()
  77.     else
  78.         turtle.up()
  79.     end
  80.    
  81.     if not turtle.detectUp() then
  82.         turtle.select(16)
  83.         turtle.placeUp()
  84.     end
  85.    
  86.     if not turtle.detect() then
  87.         turtle.select(16)
  88.         turtle.place()
  89.     end
  90.    
  91.     turtle.down()
  92.    
  93.     if turtle.detectDown() then
  94.         turtle.digDown()
  95.         turtle.down()
  96.        
  97.     else
  98.         turtle.down()
  99.     end
  100.    
  101.     if not turtle.detectDown() then
  102.         turtle.select(16)
  103.         turtle.placeDown()
  104.     end
  105.    
  106.     if not turtle.detect() then
  107.         turtle.select(16)
  108.         turtle.place()
  109.     end
  110.  
  111. end
  112.  
  113.  
  114.  
  115.  
  116. function mineAndSelect()
  117.  
  118. --Para frente
  119.     if turtle.detect() then
  120.         while turtle.detect() do
  121.             turtle.dig()
  122.         end
  123.         turtle.forward()
  124.     else
  125.         turtle.forward()
  126.     end
  127.    
  128. --Para cima
  129.     if turtle.detectUp() then
  130.         while turtle.detectUp() do
  131.             turtle.digUp()
  132.         end
  133.         turtle.up()
  134.     else
  135.         turtle.up()
  136.     end
  137.    
  138.     if not turtle.detectUp() then
  139.         turtle.select(16)
  140.         turtle.placeUp()
  141.     end
  142.    
  143.     turtle.down()
  144.    
  145. --Para baixo
  146.     if turtle.detectDown() then
  147.         turtle.digDown()
  148.         turtle.down()
  149.     else
  150.         turtle.down()
  151.     end
  152.     if not turtle.detectDown() then
  153.         turtle.select(16)
  154.         turtle.placeDown()
  155.     end
  156.     turtle.up()
  157.     turtle.turnLeft()
  158.     miningSides()
  159.    
  160.     turtle.up()
  161.     turtle.turnRight()
  162.     turtle.turnRight()
  163.     turtle.forward()
  164.    
  165.     miningSides()
  166.     turtle.up()
  167.     turtle.turnLeft()
  168.     turtle.turnLeft()
  169.     turtle.forward()
  170.     turtle.turnRight()
  171.     steps = steps + 1
  172.    
  173.     if inventoryCheck() then
  174.         goBack()
  175.     end
  176.  
  177. end
  178.  
  179. while true do
  180.     mineAndSelect()
  181.  
  182. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement