Enhance display of inventory groups with detailed device information
This commit is contained in:
@@ -71,5 +71,30 @@ local function displayGroups(itemMap)
|
||||
end
|
||||
end
|
||||
|
||||
-- Only show groups where at least one chest AND one dropper share the item
|
||||
local isGroup = #_
|
||||
-- Mark as group when at least one chest AND one dropper share the item
|
||||
local isGroup = #chests > 0 and #droppers > 0
|
||||
local tag = isGroup and "[GROUP]" or "[-----]"
|
||||
|
||||
print(tag .. " " .. itemName)
|
||||
|
||||
for _, device in ipairs(devices) do
|
||||
local label = device.type == "minecraft:chest" and "CHEST " or "DROPPER"
|
||||
print(string.format(" %s %-35s x%d", label, device.name, device.count))
|
||||
end
|
||||
|
||||
print("")
|
||||
end
|
||||
end
|
||||
|
||||
-- Main
|
||||
local devices = getInventoryDevices()
|
||||
print("Scanning " .. #devices .. " inventories...")
|
||||
print("")
|
||||
|
||||
if #devices == 0 then
|
||||
print("No chests or droppers found on the network.")
|
||||
return
|
||||
end
|
||||
|
||||
local itemMap = buildItemMap(devices)
|
||||
displayGroups(itemMap)
|
||||
|
||||
Reference in New Issue
Block a user