Advertisement
Guest User

ganchuk

a guest
Feb 19th, 2020
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.43 KB | None | 0 0
  1. function forward()
  2.  while true do
  3.   if turtle.forward() then
  4.    break
  5.    else
  6.    
  7.    for i = 1 , 16 do
  8.    
  9.     turtle.select(i)
  10.     turtle.suck()
  11.    end  
  12.    os.sleep(1)
  13.    turtle.dig()
  14.   end
  15.  end
  16. end
  17.  
  18. function up()
  19.  
  20.  while true do
  21.   if turtle.up() then
  22.    break
  23.    else
  24.    os.sleep(1)
  25.    turtle.digUp()
  26.   end
  27.  end
  28. end
  29.  
  30. function down()
  31.  
  32.  while true do
  33.   if turtle.down() then
  34.    break
  35.    else
  36.    turtle.digDown()
  37.    os.sleep(1)
  38.    
  39.   end
  40.  end
  41. end
  42.  
  43.  
  44. function fill()
  45.  
  46.  down()
  47.  
  48.  while true do
  49.  
  50.   for i = 1,16 do
  51.    if turtle.getItemDetail(i) then
  52.     if turtle.getItemDetail(i).name == "minecraft:gravel" then
  53.      turtle.select(i)
  54.     end
  55.    end
  56.   end
  57.  
  58.   if not  turtle.detectDown() then
  59.    turtle.placeDown()
  60.    else break
  61.   end
  62.  end
  63.  
  64.  up()
  65. end
  66.  
  67.  
  68.  
  69.  
  70.  
  71.  
  72.  
  73.  
  74.  
  75. function go()
  76.  
  77.  fill()
  78.  
  79.  
  80.  for i = 1,16 do
  81.  
  82.   if turtle.getItemDetail(i) then
  83.    if turtle.getItemDetail(i).name == "minecraft:dirt" then
  84.    turtle.select(i)
  85.    break
  86.    end
  87.   end
  88.  end
  89.  turtle.digDown()
  90.  turtle.placeDown()
  91.  
  92.  forward()
  93.        
  94. end
  95.  
  96.  
  97.  
  98. function cycle()
  99.  
  100.  for i = 1,y do
  101.  
  102.   go()
  103.  end
  104. end
  105.  
  106. function what()
  107.  print("type how much toward forward")
  108.  x = io.read()
  109.  print("type how much toward right")
  110.  y = io.read()
  111. end
  112. -------
  113. what()
  114.  
  115. for i = 1,x do
  116.  
  117.  cycle()
  118.  turtle.turnRight()
  119.  go()
  120.  turtle.turnRight()
  121.  cycle()
  122.  turtle.turnLeft()
  123.  go()
  124.  turtle.turnLeft()
  125.  
  126. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement