diff --git a/backend-chests.lua b/backend-chests.lua index be498d1..001eaf2 100644 --- a/backend-chests.lua +++ b/backend-chests.lua @@ -36,6 +36,10 @@ local function cache(item, chest, slot) end end +local function to_wyvern_item(plethora_item) + return { NBT = plethora_item.nbtHash, ID = plethora_item.name, damage = plethora_item, display_name = plethora_item.displayName, count = plethora_item.count } +end + local index = {} -- Update the index for the given peripheral local function update_index_for(name) @@ -43,6 +47,7 @@ local function update_index_for(name) local data = inv.list() for slot, item in pairs(data) do + data[slot] = to_wyvern_item(data[slot]) data[slot].display_name = cache(item, inv, slot) end @@ -151,7 +156,7 @@ local function server(command) end end - return { moved = items_moved_to_destination or items_moved_from_storage, item = first_available.item } + return { moved = items_moved_to_destination or items_moved_from_storage, item = to_wyvern_item(first_available.item) } elseif command.type == "insert" then local inventory_with_space = find_space() if not inventory_with_space then return w.errors.make(w.errors.NOSPACE) end -- if there's not space, say so in error