diff --git a/CraftFromContainers/BepInExPlugin.cs b/CraftFromContainers/BepInExPlugin.cs old mode 100644 new mode 100755 index 9c75165..43d3b89 --- a/CraftFromContainers/BepInExPlugin.cs +++ b/CraftFromContainers/BepInExPlugin.cs @@ -671,7 +671,7 @@ static void Postfix(InventoryGui __instance, List ___m_recipeList) - [HarmonyPatch(typeof(Player), "HaveRequirementItems", new Type[] { typeof(Recipe), typeof(bool), typeof(int) })] + [HarmonyPatch(typeof(Player), "HaveRequirementItems", new Type[] { typeof(Recipe), typeof(bool), typeof(int), typeof(int) })] static class HaveRequirementItems_Patch { static void Postfix(Player __instance, ref bool __result, Recipe piece, bool discover, int qualityLevel, HashSet ___m_knownMaterial) @@ -687,13 +687,13 @@ static void Postfix(Player __instance, ref bool __result, Recipe piece, bool dis { if (requirement.m_resItem) { - int amount = requirement.GetAmount(qualityLevel); + int resAmount = requirement.GetAmount(qualityLevel); int invAmount = __instance.GetInventory().CountItems(requirement.m_resItem.m_itemData.m_shared.m_name); - if(invAmount < amount) + if(invAmount < resAmount) { foreach(Container c in nearbyContainers) invAmount += c.GetInventory().CountItems(requirement.m_resItem.m_itemData.m_shared.m_name) - leaveMod; - if (invAmount < amount) + if (invAmount < resAmount) return; } }