CC: Restitched

CC: Restitched

3M Downloads

getting list() from item vault create does not work

Nold0r opened this issue ยท 2 comments

commented

Minecraft Version

1.19.x

Version

1.101.2

Details

hi, I have a problem getting data from the item vault mod create, when I try to get a list of items from the vault, I get nil.
I am using CC: Restitched on version 1.19.2 and UnlimitedPeripheralWorks is also installed
here is my code :

local groupedItems = {}
for i, itemChest in pairs(chest.list()) do 
    local mod, name = itemChest.name:match("([^:]+):([^:]+)")
    if groupedItems[mod] then
        if (groupedItems[mod])[name]then
            (groupedItems[mod])[name] = (groupedItems[mod])[name] + itemChest.count
        else
            (groupedItems[mod])[name] =  itemChest.count
        end
    else
        groupedItems[mod] = {[name] = itemChest.count}
    end

end
print(textutils.serialise(groupedItems))

the code gets a list of items from the repositories and converts this list into a new sorted one, and then simply outputs a table with the new list to the terminal

commented

Create utilizes a different storage API than the common slot-based one everything else uses

UnlimitedPeripheralWorks implements the ItemStorage API so that it can be used, (I think it works on normal chests as well even)f
https://docs.siredvin.site/API/item_storage/

commented

Your code
image

Adjusted to use items instead of list
image