Advertisement
rhn

Furnace x4 loader

rhn
May 19th, 2020
1,131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.24 KB | None | 0 0
  1. local function home()
  2.     while true do
  3.         while turtle.forward() do
  4.         end
  5.         turtle.turnLeft()
  6.         local success, data = turtle.inspectDown()
  7.         if success and data.name=="ironchest:iron_chest" then
  8.             turtle.turnLeft()
  9.             return
  10.         end
  11.     end
  12. end
  13.  
  14.  
  15.  
  16. local function load()
  17.     turtle.select(1)
  18.     for i=1,4 do
  19.         turtle.suckDown()
  20.     end
  21. end
  22.  
  23. local function unload(f)
  24.     for i=1,4 do
  25.         turtle.forward()
  26.         turtle.select(f[i][1])
  27.         turtle.dropDown(f[i][2])
  28.         turtle.forward()
  29.         turtle.turnRight()
  30.     end
  31.     for i=1,4 do
  32.         turtle.select(i)
  33.         turtle.dropDown()
  34.     end
  35. end
  36.  
  37. home()
  38.  
  39.  
  40. while true do
  41.     load()
  42.     if turtle.getItemCount(4)>0 then
  43.         unload({{1,64},{2,64},{3,64},{4,64}})
  44.         sleep(10)
  45.     elseif turtle.getItemCount(3)>0 then
  46.         unload({{1,64},{2,64},{3, math.ceil(turtle.getItemCount(3)/2) },{3,64}})
  47.         sleep(10)
  48.     elseif turtle.getItemCount(2)>0 then
  49.         unload({{1, math.ceil(turtle.getItemCount(1)/2) },{1,64},{2, math.ceil(turtle.getItemCount(2)/2) },{2,64}})
  50.         sleep(10)
  51.     elseif turtle.getItemCount(1)>0 then
  52.         unload({    {1, math.ceil(turtle.getItemCount(1)/4) },
  53.                     {1, math.ceil(turtle.getItemCount(1)/4) },
  54.                     {1, math.ceil(turtle.getItemCount(1)/4) },
  55.                     {1,64}
  56.                 })
  57.         sleep(10)
  58.     else
  59.         sleep(10)
  60.     end
  61. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement