Paper icon indicating copy to clipboard operation
Paper copied to clipboard

`RecipeChoice#test` isn't used to matches Ingredients in crafting menu.

Open luiz-otavio opened this issue 3 years ago • 3 comments

Is your feature request related to a problem?

Yup. I'm having some issues with custom recipes in my plugin, but it seems that ExactChoice doesn't work as a standard implementation for my specific condition to check ingredients, so I tried creating another RecipeChoice but it didn't work since Ingredient#test didn't searches for RecipeChoice#test.

Describe the solution you'd like.

I'd like for a match case for RecipeChoice#test in crafting menu, since it's already a predicate and it would be usable. Also, we could make PredicateChoice in API to let the developer choose what predicate should work for matching its ingredient.

Describe alternatives you've considered.

I think there isn't another dedicated alternative for that, since the only way to match my custom recipe is based on Ingredient#test, and it should work if it could use RecipeChoice#test

Other

It's an image from the specific code where it would be included in. image

luiz-otavio avatar Oct 09 '22 15:10 luiz-otavio

If no problem, I can make a pull-request with a dedicated patch for that.

luiz-otavio avatar Oct 09 '22 15:10 luiz-otavio

Have you tried using Events rather than built in recipe types for implementing what you're trying to do. That's how complex custom recipes are typically implemented.

Xemorr avatar Oct 17 '22 19:10 Xemorr

Have you tried using Events rather than built in recipe types for implementing what you're trying to do. That's how complex custom recipes are typically implemented.

Yes, sure. I have tried to use another events to implement that, which takes more complicated and complex rather than just making a dedicated RecipeChoice for that.

In my patch (already mentioned above), I introduced a PredicateChoice, which lets the developer choose how should it be able to match the ingredient.

luiz-otavio avatar Oct 18 '22 00:10 luiz-otavio

I plan to add this in the future after https://github.com/PaperMC/Paper/pull/7822 has been merged, but I want to do it in a way that still works with recipe book clicks which is much more involved than just adding another choice. If that turns out not to be possible, just adding the PredicateChoice and saying it won't work with recipe book clicks will be fine.

Machine-Maker avatar Jul 23 '23 07:07 Machine-Maker