Unknown 6 жил өмнө
parent
commit
f8d235ce95

+ 11 - 0
src/main/java/me/shedaniel/rei/api/ButtonAreaSupplier.java

@@ -4,8 +4,19 @@ import java.awt.*;
 
 public interface ButtonAreaSupplier {
     
+    /**
+     * Declares the button bounds
+     *
+     * @param bounds the bounds of the recipe display
+     * @return the bounds of the button
+     */
     Rectangle get(Rectangle bounds);
     
+    /**
+     * Declares the button text
+     *
+     * @return the text of the button
+     */
     default String getButtonText() {
         return "+";
     }

+ 77 - 0
src/main/java/me/shedaniel/rei/api/ClientHelper.java

@@ -11,34 +11,106 @@ import java.util.List;
 import java.util.Map;
 
 public interface ClientHelper extends ClientModInitializer {
+    /**
+     * @return the api instance of {@link ClientHelperImpl}
+     */
     static ClientHelper getInstance() {
         return ClientHelperImpl.instance;
     }
     
+    /**
+     * Checks if cheating is enabled
+     *
+     * @return whether cheating is enabled
+     */
     boolean isCheating();
     
+    /**
+     * Sets current cheating mode
+     * Should save the config in {@link ConfigManager}.
+     *
+     * @param cheating the new cheating mode
+     */
     void setCheating(boolean cheating);
     
     List<ItemStack> getInventoryItemsTypes();
     
+    /**
+     * Opens a recipe viewing screen:
+     * {@link me.shedaniel.rei.gui.PreRecipeViewingScreen} if not set
+     * {@link me.shedaniel.rei.gui.RecipeViewingScreen} if set to default
+     * {@link me.shedaniel.rei.gui.VillagerRecipeViewingScreen} if set to villager
+     *
+     * @param map the map of recipes
+     */
     void openRecipeViewingScreen(Map<RecipeCategory, List<RecipeDisplay>> map);
     
+    /**
+     * Registers REI's keybinds using Fabric API.
+     */
     void registerFabricKeyBinds();
     
+    /**
+     * Tries to cheat items using either packets or commands.
+     *
+     * @param stack the stack to cheat in
+     * @return whether it failed
+     */
     boolean tryCheatingStack(ItemStack stack);
     
+    /**
+     * Finds recipe for the item and opens the recipe screen.
+     *
+     * @param stack the stack to find recipe for
+     * @return whether the stack has any recipes to show
+     */
     boolean executeRecipeKeyBind(ItemStack stack);
     
+    /**
+     * Finds usage for the item and opens the recipe screen.
+     *
+     * @param stack the stack to find usage for
+     * @return whether the stack has any usages to show
+     */
     boolean executeUsageKeyBind(ItemStack stack);
     
+    /**
+     * Gets the mod from an item
+     *
+     * @param item
+     * @return the mod name
+     */
     String getModFromItem(Item item);
     
+    /**
+     * Tries to delete the player's cursor item
+     *
+     * @return whether it failed
+     */
     void sendDeletePacket();
     
+    /**
+     * Gets the formatted mod from an item
+     *
+     * @param item
+     * @return the mod name with blue and italic formatting
+     */
     String getFormattedModFromItem(Item item);
     
+    /**
+     * Gets the formatted mod from an identifier
+     *
+     * @param identifier
+     * @return the mod name with blue and italic formatting
+     */
     String getFormattedModFromIdentifier(Identifier identifier);
     
+    /**
+     * Gets the mod from an identifier
+     *
+     * @param identifier
+     * @return the mod name
+     */
     String getModFromIdentifier(Identifier identifier);
     
     FabricKeyBinding getRecipeKeyBinding();
@@ -51,5 +123,10 @@ public interface ClientHelper extends ClientModInitializer {
     
     FabricKeyBinding getNextPageKeyBinding();
     
+    /**
+     * Finds all recipes and open them in a recipe screen.
+     *
+     * @return whether there are any recipes to show
+     */
     boolean executeViewAllRecipesKeyBind();
 }

+ 34 - 0
src/main/java/me/shedaniel/rei/api/ConfigManager.java

@@ -7,18 +7,52 @@ import java.io.IOException;
 
 public interface ConfigManager {
     
+    /**
+     * Saves the config.
+     *
+     * @throws IOException
+     */
     void saveConfig() throws IOException;
     
+    /**
+     * Loads the config from the json file, creates the file if not found.
+     *
+     * @throws IOException
+     */
     void loadConfig() throws IOException;
     
+    /**
+     * Gets the config instance
+     *
+     * @return the config instance
+     */
     ConfigObject getConfig();
     
+    /**
+     * Gets if craftable only filter is enabled
+     *
+     * @return whether craftable only filter is enabled
+     */
     boolean isCraftableOnlyEnabled();
     
+    /**
+     * Toggles the craftable only filter
+     */
     void toggleCraftableOnly();
     
+    /**
+     * Opens the config screen
+     *
+     * @param parent the screen shown before
+     */
     void openConfigScreen(Screen parent);
     
+    /**
+     * Gets the config screen
+     *
+     * @param parent the screen shown before
+     * @return the config screen
+     */
     Screen getConfigScreen(Screen parent);
     
 }

+ 22 - 0
src/main/java/me/shedaniel/rei/api/DisplaySettings.java

@@ -2,12 +2,34 @@ package me.shedaniel.rei.api;
 
 public interface DisplaySettings<T extends RecipeDisplay> {
     
+    /**
+     * Gets the recipe display height
+     *
+     * @param category the category of the display
+     * @return the height
+     */
     int getDisplayHeight(RecipeCategory category);
     
+    /**
+     * Gets the recipe display width
+     *
+     * @param category the category of the display
+     * @param display  the display of the recipe
+     * @return the width
+     */
     int getDisplayWidth(RecipeCategory category, T display);
     
+    /**
+     * Gets the maximum amount of recipe displays of the category displayed at the same time.
+     * @param category the category of the displays
+     * @return the maximum amount
+     */
     int getMaximumRecipePerPage(RecipeCategory category);
     
+    /**
+     * Gets the fixed amount of recipes per page.
+     * @return the amount of recipes, returns -1 if not fixed
+     */
     default int getFixedRecipesPerPage() {
         return -1;
     }

+ 16 - 0
src/main/java/me/shedaniel/rei/api/DisplayVisibilityHandler.java

@@ -2,10 +2,26 @@ package me.shedaniel.rei.api;
 
 public interface DisplayVisibilityHandler {
     
+    /**
+     * Gets the priority of the handler
+     *
+     * @return the priority
+     */
     default float getPriority() {
         return 0f;
     }
     
+    /**
+     * Handles the visibility of the display.
+     * {@link DisplayVisibility.PASS} to pass the handling to another handler
+     * {@link DisplayVisibility.ALWAYS_VISIBLE} to always display it
+     * {@link DisplayVisibility.CONFIG_OPTIONAL} to allow user to configure the visibility
+     * {@link DisplayVisibility.NEVER_VISIBLE} to never display it
+     *
+     * @param category the category of the display
+     * @param display  the display of the recipe
+     * @return the visibility
+     */
     DisplayVisibility handleDisplay(RecipeCategory category, RecipeDisplay display);
     
 }

+ 5 - 0
src/main/java/me/shedaniel/rei/api/REIPlugin.java

@@ -3,6 +3,11 @@ package me.shedaniel.rei.api;
 import me.shedaniel.rei.RoughlyEnoughItemsCore;
 import net.minecraft.util.Identifier;
 
+/**
+ * Get base class of a REI plugin.
+ * This class has been replaced by {@link REIPluginEntry}
+ */
+@Deprecated
 public interface REIPlugin extends REIPluginEntry {
     @Override
     default Identifier getPluginIdentifier() {

+ 49 - 0
src/main/java/me/shedaniel/rei/api/REIPluginEntry.java

@@ -2,27 +2,76 @@ package me.shedaniel.rei.api;
 
 import net.minecraft.util.Identifier;
 
+/**
+ * Get base class of a REI plugin.
+ */
 public interface REIPluginEntry {
     
+    /**
+     * On register of the plugin
+     *
+     * @param pluginDisabler the helper class to disable other plugins
+     */
     default void onFirstLoad(PluginDisabler pluginDisabler) {}
     
+    /**
+     * Registers items on the item panel
+     *
+     * @param itemRegistry the helper class
+     */
     default void registerItems(ItemRegistry itemRegistry) {}
     
+    /**
+     * Registers categories
+     *
+     * @param recipeHelper the helper class
+     */
     default void registerPluginCategories(RecipeHelper recipeHelper) {}
     
+    /**
+     * Registers displays for categories
+     *
+     * @param recipeHelper the helper class
+     */
     default void registerRecipeDisplays(RecipeHelper recipeHelper) {}
     
+    /**
+     * Not called anymore!
+     *
+     * @param recipeHelper
+     * @see REIPluginEntry#registerOthers(RecipeHelper)
+     */
     @Deprecated
     default void registerSpeedCraft(RecipeHelper recipeHelper) {}
     
+    /**
+     * Registers bounds handlers
+     *
+     * @param displayHelper the helper class
+     */
     default void registerBounds(DisplayHelper displayHelper) {}
     
+    /**
+     * Register other stuff
+     *
+     * @param recipeHelper the helper class
+     */
     default void registerOthers(RecipeHelper recipeHelper) {}
     
+    /**
+     * Gets the priority of the plugin.
+     *
+     * @return the priority
+     */
     default int getPriority() {
         return 0;
     }
     
+    /**
+     * Get the identifier of the plugin
+     *
+     * @return the identifier
+     */
     Identifier getPluginIdentifier();
     
 }