public static bool TryCraft(CraftingMenu __instance) { try { int m_lastRecipeIndex = (int)AccessTools.Field(typeof(CraftingMenu), "m_lastRecipeIndex").GetValue(__instance); bool m_canCraft = (bool)AccessTools.Field(typeof(CraftingMenu), "m_canCraft").GetValue(__instance); if (m_lastRecipeIndex == -1 && m_canCraft) { int num = 0; CompatibleIngredient compatibleIngredient = null; IngredientSelector[] m_ingredientSelectors = (IngredientSelector[])AccessTools.Field(typeof(CraftingMenu), "m_ingredientSelectors").GetValue(__instance); for (int i = 0; i < m_ingredientSelectors.Length; i++) { if (m_ingredientSelectors[i].AssignedIngredient != null && !m_ingredientSelectors[i].IsMissingIngredient) { compatibleIngredient = m_ingredientSelectors[i].AssignedIngredient; num++; } } if (num == 1 && compatibleIngredient != null) { // lasyan3 : rancid water needs other ingredients to be cleaned if (compatibleIngredient.IsWaterItem && compatibleIngredient.WaterType == WaterType.Rancid) { CharacterUI m_characterUI = (CharacterUI)AccessTools.Field(typeof(CraftingMenu), "m_characterUI").GetValue(__instance); m_characterUI.ShowInfoNotificationLoc("Cleaning such water needs one more ingredient..."); return(false); } } } } catch (Exception ex) { WorkInProgress.Instance.MyLogger.LogError("TryCraft: " + ex.Message); } return(true); }