diff --git a/item-sorter.lua b/item-sorter.lua new file mode 100644 index 0000000..69d9813 --- /dev/null +++ b/item-sorter.lua @@ -0,0 +1,32 @@ +-- Item Sorter. Filter list is specified in itemlist.txt. +-- Ejects listed items up and unlisted items down. +-- Filter list should look like this: +-- minecraft:carrot +-- minecraft:potato +-- foodexpansion:itemhorsemeat +-- ... + +while true do + for x=1,16 do + turtle.select(x) + local item = turtle.getItemDetail() + if item ~= nil then + local match = false + local file = fs.open("itemlist.txt", "r") + local cur = file.readLine() + while cur ~= nil do + if item.name == cur then + match = true + end + cur = file.readLine() + end + if match then + print("Match => " .. item.name) + turtle.dropUp() + else + print("No match => " .. item.name) + turtle.dropDown() + end + end + end +end \ No newline at end of file