Guest User

chunk.lua

a guest
Aug 17th, 2017
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.39 KB | None | 0 0
  1. local X = 16
  2. local Y = 20
  3. local Z = 16
  4.  
  5. x = 1
  6. y = 1
  7. z = 1
  8.  
  9. running = "yes"
  10. direction = "up"
  11.  
  12. function mineX()
  13.   while turtle.detect() == true do
  14.     turtle.dig()
  15.     sleep(0.5)
  16.   end
  17.   turtle.forward()
  18.   x = x + 1
  19. end
  20.  
  21. function mineZ()
  22.   while turtle.detect() == true do
  23.     turtle.dig()
  24.     sleep(0.5)
  25.   end
  26.     turtle.forward()
  27.   z = z + 1
  28. end
  29.  
  30. function mineY()
  31.   turtle.turnRight()
  32.   while z > 1 do
  33.     turtle.forward()
  34.   end
  35.   turtle.turnRight()
  36.   if turtle.detectDown() == true then
  37.     turtle.digDown()
  38.   end
  39.   turtle.down()
  40.   y = y + 1
  41. end
  42.  
  43. function finished()
  44.   while y > 1 do
  45.     turtle.up()
  46.   end
  47.   running = "no"
  48. end
  49. function fuel()
  50.   if turtle.getFuelLevel() < 200 then
  51.     turtle.refuel(5)
  52.   end
  53. end
  54.  
  55.  
  56. while running == "yes" do
  57.  
  58. term.clear()
  59. term.setCursorPos(1,1)
  60. print("X = ".. x)
  61. print("Y = ".. y)
  62. print("Z = ".. z)
  63. print("fuel = ".. turtle.getFuelLevel())
  64.  
  65.   fuel()
  66.   if y < Y then
  67.     if z < Z then
  68.       if x < X then
  69.         mineX()
  70.       else
  71.         if direction == "up" then
  72.           turtle.turnRight()
  73.           mineZ()
  74.           turtle.turnRight()
  75.           x = 1
  76.           direction = "down"
  77.         else
  78.           turtle.turnLeft()
  79.           mineZ()
  80.           turtle.turnLeft()
  81.           x = 1
  82.           direction = "up"
  83.         end
  84.       end
  85.     else
  86.       mineY()
  87.     end
  88.   else
  89.     finished()
  90.   end
  91. end
Advertisement
Add Comment
Please, Sign In to add comment