[1.21.4] Recipe priority system for solving overlaps in recipe ingredients and patterns. #1855
+398
−0
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Updated version of #1152
This PR implements a system intended to give modders a solution to the problem of needing to implement a recipe with a pattern of ingredients, but it overlaps with a vanilla recipe that has the same pattern but using a tag instead. For example, a modder may be trying to make a Chest for a specific wood type in a custom dimension, but in Vanilla, crafting Chests uses the #planks tag, so all wood types are normally going to give the default Chest block.
Specifically, this PR does the following main things:
RecipePrioritiesProvider
, which is a data provider that can be extended to generate a map of recipeResourceLocation
s toInteger
priorities. Vanilla recipes are considered at a baseline of 0, so positive numbered recipes are higher priority and negative numbered recipes are lower priority.RecipePriorityManager
, which reads the JSON data.RecipeManager
andRecipeMap
to use ordered data types that are ordered by taking into account any priority values that are found to match a recipe ID.