SHARE
TWEET

vein

xmann110 Feb 15th, 2020 (edited) 86 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function refuel()
  2.     if turtle.getFuelLevel() < 10 then
  3.         turtle.select(1)
  4.         turtle.refuel(1)
  5.     end
  6. end
  7.  
  8. retrace = {}
  9.  
  10. while true do
  11.     refuel()
  12.  
  13.     a, b = turtle.inspect()
  14.     if a and b.name == "minecraft:coal_ore" then
  15.         turtle.dig()
  16.         turtle.forward()
  17.         table.insert(retrace, "back")
  18.     else
  19.         a, b = turtle.inspectUp()
  20.         if a and b.name == "minecraft:coal_ore" then
  21.             turtle.digUp()
  22.             turtle.up()
  23.             table.insert(retrace, "down")
  24.         else
  25.             a, b = turtle.inspectDown()
  26.             if a and b.name == "minecraft:coal_ore" then
  27.                 turtle.digDown()
  28.                 turtle.down()
  29.                 table.insert(retrace, "up")
  30.             else
  31.                 turtle.turnLeft()
  32.  
  33.                 a, b = turtle.inspect()
  34.                 if a and b.name == "minecraft:coal_ore" then
  35.                     turtle.dig()
  36.                     turtle.forward()
  37.                     table.insert(retrace, "right")
  38.                     table.insert(retrace, "back")
  39.                 else
  40.                     turtle.turnRight()
  41.                     turtle.turnRight()
  42.  
  43.                     a, b = turtle.inspect()
  44.                     if a and b.name == "minecraft:coal_ore" then
  45.                         turtle.dig()
  46.                         turtle.forward()
  47.                         table.insert(retrace, "left")
  48.                         table.insert(retrace, "back")
  49.                     else
  50.                         turtle.turnRight()
  51.                         a, b = turtle.inspect()
  52.                         if a and b.name == "minecraft:coal_ore" then
  53.                             turtle.dig()
  54.                             turtle.forward()
  55.                             table.insert(retrace, "right")
  56.                             table.insert(retrace, "back")
  57.                         else
  58.                             turtle.turnRight()
  59.                             break
  60.                         end
  61.                     end
  62.                 end
  63.             end
  64.         end
  65.     end
  66. end
  67.  
  68. for i, command in ipairs(retrace) do
  69.     if command == "forward" then
  70.         turtle.forward()
  71.     end
  72.     if command == "back" then
  73.         turtle.back()
  74.     end
  75.     if command == "right" then
  76.         turtle.turnRight()
  77.     end
  78.     if command == "left" then
  79.         turtle.turnLeft()
  80.     end
  81.     if command == "up" then
  82.         turtle.up()
  83.     end
  84.     if command == "forward" then
  85.         turtle.down()
  86.     end
  87. end
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top