Advertisement
ecco7777

lootbag compressor

Aug 13th, 2018
228
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.97 KB | None | 0 0
  1. p=peripheral.wrap("bottom")
  2. function craft(i1)
  3.     if i1~=6 then
  4.       p.pushItem("up",items[i1].pos[1],1,1)
  5.       p.pushItem("up",items[i1].pos[2],1,2)
  6.       p.pushItem("up",items[i1].pos[3],1,5)
  7.       p.pushItem("up",items[i1].pos[4],1,6)
  8.       turtle.craft()
  9.  
  10.     turtle.dropDown()
  11.     else
  12.         for i1=1,items[6].qty do
  13.             p.destroyStack(items[6].pos[i1])
  14.         end
  15.     end
  16. end
  17.  
  18. function scan()
  19.     items={{qty=0,pos={}},{qty=0,pos={}},{qty=0,pos={}},{qty=0,pos={}},{qty=0,pos={}},{qty=0,pos={}},{qty=0,pos={}},{qty=0,pos={}}}
  20.     p.condenseItems()
  21.     for i=1,p.getInventorySize() do
  22.     item=p.getStackInSlot(i)
  23.         if item~=nil then
  24.             if string.find(item.name,"lootbag") then
  25.                 items[item.dmg+1].pos[#items[item.dmg+1].pos+1]=i
  26.                 items[item.dmg+1].qty=items[item.dmg+1].qty+1
  27.             else
  28.                 if item.name~="1MinicioEssence" then
  29.                 p.destroyStack(i)
  30.                 end
  31.             end
  32.         end
  33.     end
  34. end
  35.  
  36. while true do
  37. scan()
  38.     for i2=1,#items do
  39.         if items[i2].qty>=4 then
  40.             craft(i2)
  41.         end
  42.     end
  43.     sleep(1)
  44. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement