Firnagzen

Blocker

Sep 30th, 2013
255
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.12 KB | None | 0 0
  1. local chest = peripheral.wrap("front")
  2. local craft = peripheral.wrap("right")
  3. local slot_number = chest.getSizeInventory()
  4. local craft_slots = {2, 3, 5, 6, 7, 9, 10, 11}
  5. while true do
  6.     for i=1,16 do
  7.         if turtle.getItemCount(i)>0 then
  8.             turtle.select(i)
  9.             while not turtle.drop() do
  10.                 sleep(120)
  11.             end
  12.         end
  13.     end
  14.     for i = 0, (slot_number-1) do
  15.         local info = chest.getStackInSlot(i)
  16.         if info then
  17.             if not string.find(info["name"], "Ingot") then
  18.                 if info["qty"]>9 then
  19.                     chest.pushIntoSlot("west", i, math.floor(info["qty"]/9)*9, 0)
  20.                     turtle.select(1)
  21.                     local no = turtle.getItemCount(1)
  22.                     for j, k in ipairs(craft_slots) do
  23.                         turtle.transferTo(k, no/9)
  24.                     end
  25.                     craft.craft()
  26.                     while not turtle.drop() do
  27.                         sleep(120)
  28.                     end
  29.                 end
  30.             end
  31.         end
  32.     end
  33.     chest.condense()
  34.     sleep(1200)
  35. end
Advertisement
Add Comment
Please, Sign In to add comment