Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow extracting tag information of inputs from recipe #1407

Open
tadhgmister opened this issue Oct 19, 2024 · 1 comment
Open

allow extracting tag information of inputs from recipe #1407

tadhgmister opened this issue Oct 19, 2024 · 1 comment
Labels

Comments

@tadhgmister
Copy link

Issue type:

  • ➕ Feature request

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 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.

@rubensworks
Copy link
Member

Thanks for the suggestion!

@github-project-automation github-project-automation bot moved this to Options in Features Oct 19, 2024
@rubensworks rubensworks moved this from Options to Accepted (To Do) in Features Oct 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Accepted (To Do)
Development

No branches or pull requests

2 participants