Leaving recipes for planks for more advanced machinery #13
Labels
No labels
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
oitsjustjose/Natural-Progression#13
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
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.
*
*
@paramrecipeManager The recipe manager*
@paramtag 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;
});
Thanks for your input but I think we have a better plan as discussed in #23 😄