Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions CraftFromContainers/BepInExPlugin.cs
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -671,7 +671,7 @@ static void Postfix(InventoryGui __instance, List<GameObject> ___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<string> ___m_knownMaterial)
Expand All @@ -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;
}
}
Expand Down