Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --inventory filter, ore dumping for mining
- --by toastonrye
- --Warning this script may break between versions 1.16.5 - 1.19.2
- local im = peripheral.find("inventoryManager")
- local cb = peripheral.find("chatBox")
- if not im then error("inventoryManager not found") end
- if not cb then error("chatBox not found") end
- local filter, match = false, false
- local tagFilter = {"forge:ores", "forge:raw_materials"}
- local function chatListener()
- while true do
- local event = { os.pullEvent("chat") }
- if event[3]:lower() == "ore on" then
- filter = true
- cb.sendMessageToPlayer("ORE ON", event[2])
- elseif event[3]:lower() == "ore off" then
- filter = false
- cb.sendMessageToPlayer("ORE OFF", event[2])
- end
- end
- end
- local function pushItems()
- while true do
- if filter then
- myInv = im.getItems()
- for slot, item in pairs(myInv) do
- for _, tag in pairs(item.tags) do
- for k, v in pairs(tagFilter) do
- if string.find(tag, v) then
- match = true
- break
- end
- end
- end
- if match then
- --im.removeItemFromPlayer("UP", item.count, item.slot) NO LONGER WORKS IN 1.19.2
- print(item.name .. " | " .. item.count)
- im.removeItemFromPlayerNBT("top", item.count, -1, {fromSlot=item.slot, count=item.count})
- match = false
- end
- end
- end
- os.sleep(10)
- end
- end
- parallel.waitForAny(chatListener, pushItems)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement