Advertisement
Guest User

farMelo.lua

a guest
Aug 17th, 2019
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.12 KB | None | 0 0
  1. local sleepTime = 10
  2. local fuelSlot = 16
  3.  
  4. print("Place fuel in slot " ..fuelSlot)
  5.  
  6. function digForward()
  7.     while turtle.forward() == false do
  8.         if turtle.dig() == false then
  9.             turtle.attack()
  10.         end
  11.     end
  12. end
  13.  
  14. function emptyInv()
  15.     local suc, chest = turtle.inspect()
  16.     if chest.name == "minecraft:chest" or chest.name == "minecraft:trapped_chest" then
  17.         print("chest found")
  18.         for i=1,15 do
  19.             turtle.select(i)
  20.             turtle.drop(turtle.getItemCount(i))
  21.         end
  22.     end
  23. end
  24.  
  25. function refuelMe()
  26.     print(turtle.getFuelLevel())
  27.     turtle.select(fuelSlot)
  28.     while turtle.getFuelLevel() < 1000 do
  29.         if turtle.getItemCount(fuelSlot) <= 0 then
  30.             print("low fuel")
  31.         end
  32.         turtle.refuel(1)
  33.     end
  34. end
  35.  
  36. while true do
  37.     digForward()
  38.  
  39.     local success, border = turtle.inspectDown()
  40.     if border.name == "minecraft:wool" then
  41.         emptyInv()
  42.         refuelMe()
  43.         turtle.turnRight()
  44.         turtle.turnRight()
  45.         print("Going to sleep for " ..sleepTime.. " seconds")
  46.         sleep(sleepTime)
  47.     end
  48. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement