aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorUnknown <shekwancheung0528@gmail.com>2019-05-12 01:32:04 +0800
committerUnknown <shekwancheung0528@gmail.com>2019-05-12 01:32:04 +0800
commit357388d49c306a288f2c56cb6f25589237f7284e (patch)
treedc6e3a35c247733231a62b1702adbc6f5a4b165c /src
parentaa916b6d14d62e062fec49c378e0f62b254c83ae (diff)
downloadRoughlyEnoughItems-357388d49c306a288f2c56cb6f25589237f7284e.tar.gz
RoughlyEnoughItems-357388d49c306a288f2c56cb6f25589237f7284e.tar.bz2
RoughlyEnoughItems-357388d49c306a288f2c56cb6f25589237f7284e.zip
Small documentations
Diffstat (limited to 'src')
-rw-r--r--src/main/java/me/shedaniel/rei/api/ButtonAreaSupplier.java11
-rw-r--r--src/main/java/me/shedaniel/rei/api/ClientHelper.java77
-rw-r--r--src/main/java/me/shedaniel/rei/api/ConfigManager.java34
-rw-r--r--src/main/java/me/shedaniel/rei/api/DisplaySettings.java22
-rw-r--r--src/main/java/me/shedaniel/rei/api/DisplayVisibilityHandler.java16
-rw-r--r--src/main/java/me/shedaniel/rei/api/REIPlugin.java5
-rw-r--r--src/main/java/me/shedaniel/rei/api/REIPluginEntry.java49
7 files changed, 214 insertions, 0 deletions
diff --git a/src/main/java/me/shedaniel/rei/api/ButtonAreaSupplier.java b/src/main/java/me/shedaniel/rei/api/ButtonAreaSupplier.java
index 07125643c..f7bd8517e 100644
--- a/src/main/java/me/shedaniel/rei/api/ButtonAreaSupplier.java
+++ b/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 "+";
}
diff --git a/src/main/java/me/shedaniel/rei/api/ClientHelper.java b/src/main/java/me/shedaniel/rei/api/ClientHelper.java
index d4648bbaa..225d2384f 100644
--- a/src/main/java/me/shedaniel/rei/api/ClientHelper.java
+++ b/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();
}
diff --git a/src/main/java/me/shedaniel/rei/api/ConfigManager.java b/src/main/java/me/shedaniel/rei/api/ConfigManager.java
index d23429142..536d61c60 100644
--- a/src/main/java/me/shedaniel/rei/api/ConfigManager.java
+++ b/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);
}
diff --git a/src/main/java/me/shedaniel/rei/api/DisplaySettings.java b/src/main/java/me/shedaniel/rei/api/DisplaySettings.java
index 334d6cc6f..ad9468bd2 100644
--- a/src/main/java/me/shedaniel/rei/api/DisplaySettings.java
+++ b/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;
}
diff --git a/src/main/java/me/shedaniel/rei/api/DisplayVisibilityHandler.java b/src/main/java/me/shedaniel/rei/api/DisplayVisibilityHandler.java
index 813cfaad6..435d91d49 100644
--- a/src/main/java/me/shedaniel/rei/api/DisplayVisibilityHandler.java
+++ b/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);
}
diff --git a/src/main/java/me/shedaniel/rei/api/REIPlugin.java b/src/main/java/me/shedaniel/rei/api/REIPlugin.java
index 121a57496..6351a7d1d 100644
--- a/src/main/java/me/shedaniel/rei/api/REIPlugin.java
+++ b/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() {
diff --git a/src/main/java/me/shedaniel/rei/api/REIPluginEntry.java b/src/main/java/me/shedaniel/rei/api/REIPluginEntry.java
index 786e129a0..8e3063f14 100644
--- a/src/main/java/me/shedaniel/rei/api/REIPluginEntry.java
+++ b/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();
}