hilburn

Blast Furnace Supplier

Aug 13th, 2014
268
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.58 KB | None | 0 0
  1. chest=peripheral.wrap("left")
  2. blastdir="east"
  3.  
  4. while true do
  5.     os.pullEvent("redstone")
  6.     if rs.getInput("top") then
  7.         local inventory=chest.getAllStacks()
  8.         local irontotal=0
  9.         local ironloc={}
  10.         for i,j in pairs(inventory) do
  11.             if j.name=="Iron Ingot" then
  12.                 irontotal=irontotal+j.qty
  13.                 ironloc[#ironloc+1]=i
  14.             end
  15.         end
  16.             local pushIron=math.floor(irontotal/9)
  17.             local ironKey=1
  18.             for i=1,9 do
  19.                 toPush=pushIron
  20.                 while toPush>0 do
  21.                     toPush=toPush-chest.pushItem(blastdir,ironloc(ironKey),toPush,11-i)
  22.                     ironKey=ironKey+1
  23.                 end
  24.             end
  25.            
  26.     end
  27. end
Advertisement
Add Comment
Please, Sign In to add comment