1414import gregtech .api .util .GTLog ;
1515import gregtech .api .util .ShapedOreEnergyTransferRecipe ;
1616import gregtech .api .util .world .DummyWorld ;
17+ import gregtech .common .ConfigHolder ;
1718import net .minecraft .block .Block ;
1819import net .minecraft .creativetab .CreativeTabs ;
1920import net .minecraft .inventory .InventoryCrafting ;
@@ -478,28 +479,32 @@ public static boolean removeFurnaceSmelting(ItemStack input) {
478479 RecipeMap .setFoundInvalidRecipe (true );
479480 return false ;
480481 }
482+
483+ boolean wasRemoved = false ;
481484 for (ItemStack stack : FurnaceRecipes .instance ().getSmeltingList ().keySet ()) {
482485 if (ItemStack .areItemStacksEqual (input , stack )) {
483486 FurnaceRecipes .instance ().getSmeltingList ().remove (stack );
484- return true ;
487+ wasRemoved = true ;
485488 }
486489 }
487- return false ;
488- }
489-
490- public static int removeRecipes (Item output ) {
491- return removeRecipes (recipe -> {
492- ItemStack recipeOutput = recipe .getRecipeOutput ();
493- return !recipeOutput .isEmpty () && recipeOutput .getItem () == output ;
494- });
490+ if (ConfigHolder .debug ) {
491+ if (wasRemoved )
492+ GTLog .logger .info ("Removed Smelting Recipe for Input: {}" , input .getDisplayName ());
493+ else GTLog .logger .warn ("Failed to Remove Smelting Recipe for Input: {}" , input .getDisplayName ());
494+ }
495+
496+ return wasRemoved ;
495497 }
496498
497499 public static int removeRecipes (ItemStack output ) {
498- return removeRecipes (recipe -> ItemStack .areItemStacksEqual (recipe .getRecipeOutput (), output ));
499- }
500+ int recipesRemoved = removeRecipes (recipe -> ItemStack .areItemStacksEqual (recipe .getRecipeOutput (), output ));
500501
501- public static <R extends IRecipe > int removeRecipes (Class <R > recipeClass ) {
502- return removeRecipes (recipeClass ::isInstance );
502+ if (ConfigHolder .debug ) {
503+ if (recipesRemoved != 0 )
504+ GTLog .logger .info ("Removed {} Recipe(s) with Output: {}" , recipesRemoved , output .getDisplayName ());
505+ else GTLog .logger .warn ("Failed to Remove Recipe with Output: {}" , output .getDisplayName ());
506+ }
507+ return recipesRemoved ;
503508 }
504509
505510 public static int removeRecipes (Predicate <IRecipe > predicate ) {
@@ -520,10 +525,53 @@ public static int removeRecipes(Predicate<IRecipe> predicate) {
520525 return recipesRemoved ;
521526 }
522527
528+ /**
529+ * Removes a Crafting Table Recipe with the given name.
530+ *
531+ * @param location The ResourceLocation of the Recipe.
532+ * Can also accept a String.
533+ */
523534 public static void removeRecipeByName (ResourceLocation location ) {
535+ if (ConfigHolder .debug ) {
536+ String recipeName = location .toString ();
537+ if (ForgeRegistries .RECIPES .containsKey (location ))
538+ GTLog .logger .info ("Removed Recipe with Name: {}" , recipeName );
539+ else GTLog .logger .warn ("Failed to Remove Recipe with Name: {}" , recipeName );
540+ }
524541 ForgeRegistries .RECIPES .register (new DummyRecipe ().setRegistryName (location ));
525542 }
526543
544+ public static void removeRecipeByName (String recipeName ) {
545+ removeRecipeByName (new ResourceLocation (recipeName ));
546+ }
547+
548+ /**
549+ * Removes Crafting Table Recipes with a range of names, being {@link GTValues} voltage names.
550+ * An example of how to use it:
551+ *
552+ * <cr>
553+ * removeTieredRecipeByName("gregtech:transformer_", EV, UV);
554+ * </cr>
555+ *
556+ * This will remove recipes with names:
557+ *
558+ * <cr>
559+ * gregtech:transformer_ev
560+ * gregtech:transformer_iv
561+ * gregtech:transformer_luv
562+ * gregtech:transformer_zpm
563+ * gregtech:transformer_uv
564+ * </cr>
565+ *
566+ * @param recipeName The base name of the Recipes to remove.
567+ * @param startTier The starting tier index, inclusive.
568+ * @param endTier The ending tier index, inclusive.
569+ */
570+ public static void removeTieredRecipeByName (String recipeName , int startTier , int endTier ) {
571+ for (int i = startTier ; i <= endTier ; i ++)
572+ removeRecipeByName (String .format ("%s%s" , recipeName , GTValues .VN [i ].toLowerCase ()));
573+ }
574+
527575 ///////////////////////////////////////////////////
528576 // Get Recipe Output Helpers //
529577 ///////////////////////////////////////////////////
0 commit comments