From cfe35b0bef26efbecd6e446f36abcf0f50fa3ee7 Mon Sep 17 00:00:00 2001 From: Wilhelm Schuster Date: Wed, 5 Jul 2023 17:14:44 +0200 Subject: [PATCH] Improve javadocs for handler and catalyst APIs --- src/main/java/codechicken/nei/api/API.java | 9 +++++---- .../nei/event/NEIRegisterHandlerInfosEvent.java | 12 +++++++++--- .../java/codechicken/nei/recipe/IRecipeHandler.java | 2 +- 3 files changed, 15 insertions(+), 8 deletions(-) diff --git a/src/main/java/codechicken/nei/api/API.java b/src/main/java/codechicken/nei/api/API.java index f04b4a30..ff02babe 100644 --- a/src/main/java/codechicken/nei/api/API.java +++ b/src/main/java/codechicken/nei/api/API.java @@ -346,7 +346,7 @@ public class API { * category. * * @param stack the ingredient that can craft recipes (like a furnace or crafting table) - * @param handler the recipe category handled by the ingredient + * @param handler the handler that shows the ingredient's recipes * @param priority higher priority comes first, default to 0 */ public static void addRecipeCatalyst(ItemStack stack, IRecipeHandler handler, int priority) { @@ -366,9 +366,10 @@ public class API { * Recipes) Allows players to see what ingredient they need to craft in order to make recipes from a recipe * category. * - * @param stack the ingredient that can craft recipes (like a furnace or crafting table) - * @param handlerID recipe category identifier (see also {@link RecipeCatalysts#getRecipeID(IRecipeHandler)}) - * @param priority higher priority comes first, default to 0 + * @param stack the ingredient that can craft recipes (like a furnace or crafting table) + * @param catalystHandlerID catalyst handler identifier (see + * {@link RecipeCatalysts#getCatalystHandlerId(IRecipeHandler)}) + * @param priority higher priority comes first, default to 0 */ public static void addRecipeCatalyst(ItemStack stack, String catalystHandlerID, int priority) { RecipeCatalysts.addRecipeCatalyst(catalystHandlerID, new CatalystInfo(stack, priority)); diff --git a/src/main/java/codechicken/nei/event/NEIRegisterHandlerInfosEvent.java b/src/main/java/codechicken/nei/event/NEIRegisterHandlerInfosEvent.java index 8f40546d..99433adc 100644 --- a/src/main/java/codechicken/nei/event/NEIRegisterHandlerInfosEvent.java +++ b/src/main/java/codechicken/nei/event/NEIRegisterHandlerInfosEvent.java @@ -11,7 +11,7 @@ import codechicken.nei.recipe.IRecipeHandler; import cpw.mods.fml.common.eventhandler.Event; /** - * Event is posted every time the handler infos got registered or reloaded. During it, you can safely register your + * Event is posted every time the handler infos get registered or reloaded. During it, you can safely register your * custom handler info. * *
@@ -21,9 +21,15 @@ import cpw.mods.fml.common.eventhandler.Event; */ public class NEIRegisterHandlerInfosEvent extends Event { - public void registerHandlerInfo(String handlerName, String modName, String modId, + /** + * @param handlerID handler identifier as returned by {@link IRecipeHandler#getHandlerId} + * @param modName display name of the mod to which the recipe handler belongs + * @param modId modId of the mod for which the recipe handler is responsible + * @param builder + */ + public void registerHandlerInfo(String handlerID, String modName, String modId, Consumer builder) { - HandlerInfo.Builder b = new HandlerInfo.Builder(handlerName, modName, modId); + HandlerInfo.Builder b = new HandlerInfo.Builder(handlerID, modName, modId); builder.accept(b); HandlerInfo info = b.build(); if (GuiRecipeTab.handlerMap.put(info.getHandlerName(), info) != null) { diff --git a/src/main/java/codechicken/nei/recipe/IRecipeHandler.java b/src/main/java/codechicken/nei/recipe/IRecipeHandler.java index 76fb41aa..939b5f2f 100644 --- a/src/main/java/codechicken/nei/recipe/IRecipeHandler.java +++ b/src/main/java/codechicken/nei/recipe/IRecipeHandler.java @@ -29,7 +29,7 @@ public interface IRecipeHandler { /** * - * @return The name of this inventory. To be displayed at the top of the viewing container. + * @return The display name of this handler. To be displayed at the top of the viewing container. */ String getRecipeName();