Leaving recipes for planks for more advanced machinery #13

Closed
opened 2020-03-16 05:04:46 +00:00 by import_user_oitsjustjose_95mQ · 1 comment
import_user_oitsjustjose_95mQ commented 2020-03-16 05:04:46 +00:00 (Migrated from git.oitsjustjose.com)

Your mod removes all plank recipes, need a way to specify for more advanced machinery to keep their recipes for planks. Tried using data_packs but they get removed as well. I could have made this config option but so far the corail_woodcutter mod is the only machinery that collides with natural progression so i just hard coded it.
The change I made to the mod... on RecipeRemover.java starting at around line 103 I changed the method...
/**
* Removes all crafting recipes with an output item contained in the specified tag.
*
* @param recipeManager The recipe manager
* @param tag The tag
*/
private static void removeRecipes(final RecipeManager recipeManager, final Tag tag)
{
//this could be a config setting of pipe delineated mod ids
String validPattern = "(corail_woodcutter:)"; //Separate with "|" pipe symbol for or like so "(corail_woodcutter:|somemod:)"
//create the regex pattern here no use recreating it ever time
Pattern p = Pattern.compile(validPattern);
final int recipesRemoved = removeRecipes(recipeManager, recipe -> {
final ItemStack recipeOutput = recipe.getRecipeOutput();
//make the match on the reipe id
Matcher matcher = p.matcher(recipe.getId().toString());
//store the result in a variable
boolean found = matcher.find();
//add the && !found result to existing code
return !recipeOutput.isEmpty() && recipeOutput.getItem().isIn(tag)
&& !(recipe.getSerializer() instanceof DamageItemRecipe.Serializer) && !found;
});

    NaturalProgression.getInstance().LOGGER.info("Removed {} recipe(s) for tag {}", recipesRemoved, tag.getId());
}
Your mod removes all plank recipes, need a way to specify for more advanced machinery to keep their recipes for planks. Tried using data_packs but they get removed as well. I could have made this config option but so far the corail_woodcutter mod is the only machinery that collides with natural progression so i just hard coded it. The change I made to the mod... on RecipeRemover.java starting at around line 103 I changed the method... /** * Removes all crafting recipes with an output item contained in the specified tag. * * `@param` recipeManager The recipe manager * `@param` tag The tag */ private static void removeRecipes(final RecipeManager recipeManager, final Tag<Item> tag) { //this could be a config setting of pipe delineated mod ids String validPattern = "(corail_woodcutter:)"; //Separate with "|" pipe symbol for or like so "(corail_woodcutter:|somemod:)" //create the regex pattern here no use recreating it ever time Pattern p = Pattern.compile(validPattern); final int recipesRemoved = removeRecipes(recipeManager, recipe -> { final ItemStack recipeOutput = recipe.getRecipeOutput(); //make the match on the reipe id Matcher matcher = p.matcher(recipe.getId().toString()); //store the result in a variable boolean found = matcher.find(); //add the && !found result to existing code return !recipeOutput.isEmpty() && recipeOutput.getItem().isIn(tag) && !(recipe.getSerializer() instanceof DamageItemRecipe.Serializer) && !found; }); NaturalProgression.getInstance().LOGGER.info("Removed {} recipe(s) for tag {}", recipesRemoved, tag.getId()); }
import_user_oitsjustjose_95mQ commented 2020-05-05 02:02:45 +00:00 (Migrated from git.oitsjustjose.com)

Thanks for your input but I think we have a better plan as discussed in #23 😄

Thanks for your input but I think we have a better plan as discussed in #23 :smile:
import_user_oitsjustjose_95mQ (Migrated from git.oitsjustjose.com) closed this issue 2020-05-05 02:02:45 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
oitsjustjose/Natural-Progression#13
No description provided.