diff --git a/CommonApi/src/main/java/mezz/jei/api/runtime/IIngredientManager.java b/CommonApi/src/main/java/mezz/jei/api/runtime/IIngredientManager.java index 0af6b79a3..34719789f 100644 --- a/CommonApi/src/main/java/mezz/jei/api/runtime/IIngredientManager.java +++ b/CommonApi/src/main/java/mezz/jei/api/runtime/IIngredientManager.java @@ -177,6 +177,24 @@ default Optional> createTypedIngredient(V ingredient) { */ Optional> createClickableIngredient(IIngredientType ingredientType, V ingredient, Rect2i area, boolean normalize); + /** + * Create a clickable ingredient. + * + * @see IClickableIngredient + * + * @param ingredient the ingredient being clicked + * @param area the area that this clickable ingredient is drawn in, in absolute screen coordinates. + * @param normalize set true to normalize the ingredient (see {@link IIngredientHelper#normalizeIngredient} + * + * @return a clickable ingredient, or {@link Optional#empty()} if the ingredient is invalid (see {@link IIngredientHelper#isValidIngredient} + * + * @since 19.18.6 + */ + default Optional> createClickableIngredient(V ingredient, Rect2i area, boolean normalize) { + return getIngredientTypeChecked(ingredient) + .flatMap(type -> createClickableIngredient(type, ingredient, area, normalize)); + } + /** * Get an ingredient by the given unique id. * This uses the uids from {@link IIngredientHelper#getUniqueId(Object, UidContext)} diff --git a/gradle.properties b/gradle.properties index 6f3003e32..87334a8a0 100644 --- a/gradle.properties +++ b/gradle.properties @@ -74,4 +74,4 @@ modrinthId=u6dRKJwZ jUnitVersion=5.8.2 # Version -specificationVersion=19.18.5 +specificationVersion=19.18.6