When a recipe uses item variant tags it should be possible to detect and extract the tag name somehow.
As I understand it, the ingredients structure does not retain any information about tag variants, when you have a recipe like a crafting table that takes 4 of any item with the tag minecraft:planks, any operation to extract information about the inputs immediately replaces this with the first viable item with this tag (oak planks) and no further logic can be done based on the tag.
Use cases
it would be desirable to have a way to override the tag in a recipe to be the type of item that is most present in the system instead of just the "first" one based on arbitrary item registry order, this could be done by reading the tag from the recipe, getting viable item types and choosing the one with the highest count in the network for instance.
Using the "network count of item" operator from the network reader, I've created a predicate that takes an Ingredients structure and returns true if the ingredients are present on the network. When I have a recipe for crafting table, chest, stick, etc. and use Recipe.input() my operator only returns true if the network contains oak planks and not for any other type of plank. I would like to update this to be able to handle tag variants if possible. I would like to be able to account for this case.
Suggested implementation
At minimum it would be nice to have a "get input item tags from recipe" operator that returns a list of strings with the same length as recipe.input().items() which contains the tag name if it is applicable to that slot or an empty string if not.
Preferably there would be a few supporting functions added to the ingredients structure as it is the more natural place to deal with this and allow methods like Recipe.withInput to generate recipes that use tags although I imagine the use cases for that would be very slim. It might be nice to also add similar functions to read or set reusable fields or strict NBT as these are similarly not retained in the ingredients structure and might be useful to operate on.
Issue type:
Short description:
When a recipe uses item variant tags it should be possible to detect and extract the tag name somehow.
As I understand it, the ingredients structure does not retain any information about tag variants, when you have a recipe like a crafting table that takes 4 of any item with the tag
minecraft:planks
, any operation to extract information about the inputs immediately replaces this with the first viable item with this tag (oak planks) and no further logic can be done based on the tag.Use cases
it would be desirable to have a way to override the tag in a recipe to be the type of item that is most present in the system instead of just the "first" one based on arbitrary item registry order, this could be done by reading the tag from the recipe, getting viable item types and choosing the one with the highest count in the network for instance.
Using the "network count of item" operator from the network reader, I've created a predicate that takes an
Ingredients
structure and returns true if the ingredients are present on the network. When I have a recipe for crafting table, chest, stick, etc. and useRecipe.input()
my operator only returns true if the network contains oak planks and not for any other type of plank. I would like to update this to be able to handle tag variants if possible. I would like to be able to account for this case.Suggested implementation
At minimum it would be nice to have a "get input item tags from recipe" operator that returns a list of strings with the same length as
recipe.input().items()
which contains the tag name if it is applicable to that slot or an empty string if not.Preferably there would be a few supporting functions added to the ingredients structure as it is the more natural place to deal with this and allow methods like
Recipe.withInput
to generate recipes that use tags although I imagine the use cases for that would be very slim. It might be nice to also add similar functions to read or setreusable
fields orstrict NBT
as these are similarly not retained in the ingredients structure and might be useful to operate on.