legg0028

refuelLava

May 4th, 2014 (edited)
1,116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.05 KB | None | 0 0
  1. local nCount = 0
  2. local dCount = 0
  3. local fCount = turtle.getFuelLevel()
  4. if fCount < 100 then
  5.   print("Turtle firstly needs at least 100 fuel")
  6.   return
  7. end
  8.  
  9. while turtle.getItemDetail()["name"] ~= "minecraft:bucket" do
  10.   term.clear()
  11.   term.setCursorPos(1,1)
  12.   print("Put an empty bucket in slot 1 and place facing a lava lake./nPress any key to begin.")
  13.   io.read()
  14. end
  15.  
  16. for x = 1,4 do
  17.   turtle.forward()
  18. end
  19. repeat
  20.   if not turtle.down() then
  21.     break
  22.   end
  23.   dCount = dCount + 1
  24. until turtle.placeDown()
  25. repeat
  26.   for x = 1,4 do
  27.     turtle.place()
  28.     turtle.refuel()
  29.     turtle.turnLeft()
  30.   end
  31.   nCount = nCount+1
  32. until not turtle.down()
  33. for x = 1,3 do
  34.   turtle.forward()
  35. end
  36. for x = 1,nCount do
  37.   for x = 1,4 do
  38.     turtle.place()
  39.     turtle.refuel()
  40.     turtle.turnLeft()
  41.   end
  42.   turtle.up()
  43. end
  44. for x = 1,(dCount - 1) do
  45.   turtle.up()
  46. end
  47. for x = 1,7 do
  48.   turtle.back()
  49. end
  50.  
  51. refCount = turtle.getFuelLevel() - fCount
  52.  
  53. print("Turtle refueled "..refCount.." fuel.")
  54. print("Total fuel level: "..turtle.getFuelLevel())
Add Comment
Please, Sign In to add comment