Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- sorter = peripheral.wrap("back")
- local directions = { [0]=0,[1]=1,[2]=2,[3]=3,[4]=4,[5]=5,["down"] = 0, ["up"] = 1, ["-Z"] = 2, ["+Z"] = 3, ["-X"] = 4, ["+X"] = 5, ["+Y"] = 1, ["-Y"] = 0}
- function getItems(dir)
- uuid = {}
- items = {}
- metas = {}
- amounts = {}
- for id,count in pairs(sorter.list(directions[dir])) do
- table.insert(uuid,id)
- table.insert(amounts,count)
- if id > 2^15 then
- metat = 0
- while true do
- metat = metat + 1
- idt = id - (2^15)*metat
- if idt < 2^15 then
- break
- end
- end
- table.insert(items,idt)
- table.insert(metas,metat)
- else
- table.insert(items,id)
- table.insert(metas,0)
- end
- end
- end
- while true do
- getItems("-X")
- for i=1,#items do
- if items[i] == 8803 and metas[i] ~= 0 then
- extractid = uuid[i]
- break
- else
- extractid = nil
- end
- end
- if extractid ~= nil then
- getItems("down")
- if #items < 9 then
- sorter.extract(directions["-X"],extractid,directions["down"],1)
- end
- end
- os.sleep(1)
- end
Advertisement
Add Comment
Please, Sign In to add comment