diff --git a/inventoryManager.lua b/inventoryManager.lua index 7c4200a..2a33dd0 100644 --- a/inventoryManager.lua +++ b/inventoryManager.lua @@ -1188,6 +1188,8 @@ end ------------------------------------------------- local function autoSmelt() + if smeltingPaused then return false end + local furnaces = getFurnaces() if #furnaces == 0 then return end @@ -1314,7 +1316,7 @@ local function autoSmelt() end end - if compatible and catalogue[itemName] then + if compatible and not disabledRecipes[itemName] and catalogue[itemName] then -- Count total of this item across all chests local totalInStorage = 0 for _, src in ipairs(catalogue[itemName]) do @@ -1514,6 +1516,66 @@ local function handleTouch(x, y) end end +------------------------------------------------- +-- Smelter touch handler +------------------------------------------------- + +local function handleSmelterTouch(x, y) + local action, data = smelterHitTest(x, y) + if not action then return end + + if action == "tab" then + smelterView = data + smelterPage = 1 + print("[SMELT-UI] Tab: " .. data) + smelterNeedsRedraw = true + + elseif action == "toggle_pause" then + smeltingPaused = not smeltingPaused + print("[SMELT-UI] Smelting " .. (smeltingPaused and "PAUSED" or "RESUMED")) + saveDisabledRecipes() + smelterNeedsRedraw = true + needsRedraw = true + + elseif action == "toggle_recipe" then + if disabledRecipes[data] then + disabledRecipes[data] = nil + else + disabledRecipes[data] = true + end + local short = data:gsub("^minecraft:", ""):gsub("_", " ") + print("[SMELT-UI] Recipe " .. short .. ": " .. (disabledRecipes[data] and "OFF" or "ON")) + saveDisabledRecipes() + smelterNeedsRedraw = true + + elseif action == "enable_all" then + disabledRecipes = {} + print("[SMELT-UI] All recipes enabled") + saveDisabledRecipes() + smelterNeedsRedraw = true + + elseif action == "disable_all" then + for inputName in pairs(SMELTABLE) do + disabledRecipes[inputName] = true + end + print("[SMELT-UI] All recipes disabled") + saveDisabledRecipes() + smelterNeedsRedraw = true + + elseif action == "page_prev" then + if smelterPage > 1 then + smelterPage = smelterPage - 1 + end + smelterNeedsRedraw = true + + elseif action == "page_next" then + if smelterPage < smelterTotalPages then + smelterPage = smelterPage + 1 + end + smelterNeedsRedraw = true + end +end + ------------------------------------------------- -- Main -------------------------------------------------