Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ---@diagnostic disable: undefined-global
- peripheral.find("modem", rednet.open)
- local chest = peripheral.find("minecraft:chest")
- local lastItems = {}
- local items = {}
- while true do
- local total = 0
- items = {}
- for i = 1, chest.size(), 1 do
- total = total + chest.getItemLimit(i)
- end
- for slot, item in pairs(chest.list()) do
- if items[item.name] ~= nil then
- items[item.name] = items[item.name] + item.count
- else
- items[item.name] = item.count
- end
- end
- if items ~= lastItems and items ~= {} then
- rednet.send(22, {items, total})
- lastItems = items
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement