Advertisement
ColdIV

ShearDown

Jun 9th, 2021 (edited)
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.85 KB | None | 0 0
  1. -- shear in slot 1
  2. local shearData = turtle.getItemDetail(1)
  3. local shearType = shearData.name
  4. local data = turtle.getItemDetail(2) -- fuel slot 2
  5. local fuelType = data.name
  6.  
  7. function checkFuel ()
  8.     if turtle.getFuelLevel() <= 0 then
  9.         print ("no fuel\n")
  10.         for i = 1, 16, 1 do
  11.             if turtle.getItemDetail(i).name == fuelType then
  12.                 turtle.select(i)
  13.                 turtle.refuel()
  14.                 print ("refuel\n")
  15.                 return true
  16.             end
  17.         end
  18.  
  19.         print ("out of fuel\n")
  20.         return false
  21.     end
  22.    
  23.     return true
  24. end
  25.  
  26. while true do
  27.     checkFuel()
  28.    
  29.     local data = turtle.getItemDetail(1)
  30.     if data.name ~= shearType then
  31.         print ("Error! No shear.")
  32.         break
  33.     end
  34.     turtle.select(1)
  35.     turtle.placeDown()
  36.     turtle.suckDown()
  37. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement