Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local clients = peripheral.call("back", "getNamesRemote")
- local chests = {}
- local items = {}
- local function DiscoverChests()
- for k,client in pairs(clients) do
- if (string.sub(peripheral.getType(client), 1, 19) == "minecraft:ironchest") then
- table.insert(chests, client)
- end
- end
- end
- DiscoverChests()
- for _k,chest in pairs(chests) do
- local chestP = peripheral.wrap(chest)
- for k,item in pairs(chestP.list()) do
- local itemTable = {}
- itemTable.metaData = item.getMetadata()
- itemTable.displayName = itemTable.metaData.displayName
- itemTable.name = item.name
- itemTable.count = item.count
- itemTable.chest = chest
- end
- end
- for k,v in pairs(items) do
- print(v.name..": "..v.count)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement