Enhance auto-smelting function to handle output item transfer and check for extra slots
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user