Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- inventoryName="tile_extrautils_chestfull_name"
- furnaceName="container_furnace"
- sides={"north","south"}
- function wrapPs(peripheralName)
- periTab={}
- sideTab={}
- if peripheralName==nil then
- print("Fehler")
- end
- local peripherals = peripheral.getNames()
- local i2 = 1
- for i =1, #peripherals do
- if peripheral.getType(peripherals[i])==peripheralName then
- periTab[i2]=peripheral.wrap(peripherals[i])
- sideTab[i2]=peripherals[i]
- i2=i2+1
- end
- end
- if periTab~={} then
- return periTab,sideTab
- else
- return nil
- end
- end
- chests=wrapPs(inventoryName)
- furns=wrapPs(furnaceName)
- function getSumOfItems()
- soi=0
- for i=1, #chests do
- if chests[i]~=nil then
- if chests[i].getStackInSlot(1)~=nil then
- soi=soi+chests[i].getStackInSlot(1).qty
- end
- end
- end
- return soi
- end
- function evenOut()
- soi=getSumOfItems()
- finished=false
- continue=true
- while continue do
- finished=true
- for i=1, #chests do
- if chests[i]~=nil then
- if chests[i].getStackInSlot(1)~=nil then
- if chests[i].getStackInSlot(1).qty>soi/#chests then
- soi=soi+chests[i].pushItemIntoSlot(sides[math.random(2)],1,1,1)
- finished=false
- end
- end
- end
- end
- if finished==true then
- continue=false
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement