/// <summary>The method to call before <see cref="ForgeMenu.SpendLeftItem"/>.</summary> /// <returns>Returns whether to run the original method.</returns> private static bool Before_SpendRightItem(ForgeMenu __instance) { if (ForgeMenuPatcher.justCrafted != null) { ForgeMenuPatcher.justCrafted.IngredientItem.Consume(ref __instance.rightIngredientSpot.item); ForgeMenuPatcher.justCrafted = null; return(false); } return(true); }
/// <summary>The method to call before <see cref="ForgeMenu.CraftItem"/>.</summary> /// <returns>Returns whether to run the original method.</returns> private static bool Before_CraftItem(ForgeMenu __instance, Item left_item, Item right_item, bool forReal, ref Item __result) { if (left_item == null || right_item == null) { return(true); } foreach (var recipe in CustomForgeRecipe.Recipes) { if (recipe.BaseItem.HasEnoughFor(left_item) && recipe.IngredientItem.HasEnoughFor(right_item)) { if (forReal) { ForgeMenuPatcher.justCrafted = recipe; } __result = recipe.CreateResult(left_item, right_item); return(false); } } return(true); }