From 34e308161f15f8073a8f2009f3d60f044ee282e7 Mon Sep 17 00:00:00 2001 From: MayaTheShy Date: Sun, 15 Mar 2026 22:32:43 -0400 Subject: [PATCH] Enhance auto-smelting function to handle output item transfer and check for extra slots --- inventoryManager.lua | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/inventoryManager.lua b/inventoryManager.lua index ef91819..f765ae7 100644 --- a/inventoryManager.lua +++ b/inventoryManager.lua @@ -735,13 +735,36 @@ local function autoSmelt() -- 1) Pull finished output (slot 3) back to chests if contents[SLOT_OUTPUT] then + local outputItem = contents[SLOT_OUTPUT] + local remaining = outputItem.count for _, chest in ipairs(chests) do local n = furnace.pushItems(chest, SLOT_OUTPUT) if n and n > 0 then + remaining = remaining - n print(string.format("[SMELT] Output %s x%d -> %s", - contents[SLOT_OUTPUT].name, n, chest)) + outputItem.name, n, chest)) didWork = true - break + if remaining <= 0 then break end + end + end + if remaining > 0 then + print(string.format("[WARN] Could not move %d %s from %s output (chests full?)", + remaining, outputItem.name, fname)) + end + end + + -- Also check all slots in case output ended up elsewhere + -- Some modded furnaces or CC versions may use different slot indices + for slot, item in pairs(contents) do + if slot ~= SLOT_INPUT and slot ~= SLOT_FUEL and slot ~= SLOT_OUTPUT then + for _, chest in ipairs(chests) do + local n = furnace.pushItems(chest, slot) + if n and n > 0 then + print(string.format("[SMELT] Extra slot %d: %s x%d -> %s", + slot, item.name, n, chest)) + didWork = true + break + end end end end