Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local chest = peripheral.wrap("right")
- local size = chest.getInventorySize()
- local oresDir = "south"
- local dustsDir = "north"
- chest.condenseItems()
- local oArray = {"15:0", --iron ore
- "30888:17", --iron solution
- "14:0", --gold
- "30888:18"}
- local dArray = {"30888:1", --iron dust
- "30888:9", --iron slurry
- "30888:2", --gold dust
- "30888:10"}
- print("size is: " .. size)
- --pulled = chest.pullItemIntoSlot("west", 1, 64, 1)
- --pushed = chest.pushItemIntoSlot("west", 1, 64, 1)
- --print(pushed)
- --see if item is extractable
- function isOre(ore)
- for k,v in pairs(oArray) do
- if (ore == v) then
- return true
- end
- end
- return false
- end
- function isDust(dust)
- for x,y in pairs(dArray) do
- if (dust == y) then
- return true
- end
- end
- return false
- end
- --isOre(15)
- --loop throught the inventory
- for i=1,size do
- print (i)
- local id = chest.getStackInSlot(i)
- if (id ~= nil) then
- local combID = tostring(id["id"])..":"..tostring(id["dmg"])
- --print (combID)
- --print (type(combID))
- if (isOre(combID)) then
- --print(id["name"])
- chest.pushItem(oresDir,i,64)
- elseif (isDust(combID)) then
- --print(id["name"])
- chest.pushItem(dustsDir,i,64)
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement