aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/me/shedaniel/rei/api
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/me/shedaniel/rei/api')
-rw-r--r--src/main/java/me/shedaniel/rei/api/BaseBoundsHandler.java19
-rw-r--r--src/main/java/me/shedaniel/rei/api/ClientHelper.java21
-rw-r--r--src/main/java/me/shedaniel/rei/api/DisplayHelper.java5
-rw-r--r--src/main/java/me/shedaniel/rei/api/ItemRegistry.java17
-rw-r--r--src/main/java/me/shedaniel/rei/api/PluginDisabler.java31
-rw-r--r--src/main/java/me/shedaniel/rei/api/RecipeDisplay.java19
-rw-r--r--src/main/java/me/shedaniel/rei/api/RecipeHelper.java91
-rw-r--r--src/main/java/me/shedaniel/rei/api/Renderable.java40
-rw-r--r--src/main/java/me/shedaniel/rei/api/Renderer.java10
-rw-r--r--src/main/java/me/shedaniel/rei/api/SpeedCraftFunctional.java19
10 files changed, 257 insertions, 15 deletions
diff --git a/src/main/java/me/shedaniel/rei/api/BaseBoundsHandler.java b/src/main/java/me/shedaniel/rei/api/BaseBoundsHandler.java
index f363dccac..3aaf1f482 100644
--- a/src/main/java/me/shedaniel/rei/api/BaseBoundsHandler.java
+++ b/src/main/java/me/shedaniel/rei/api/BaseBoundsHandler.java
@@ -11,11 +11,30 @@ import java.awt.*;
import java.util.List;
public interface BaseBoundsHandler extends DisplayHelper.DisplayBoundsHandler<Screen> {
+ /**
+ * Gets the exclusion zones by the screen class
+ *
+ * @param currentScreenClass the current screen class
+ * @param isOnRightSide whether the user has set the overlay to the right
+ * @return the list of exclusion zones
+ */
List<Rectangle> getCurrentExclusionZones(Class<? extends Screen> currentScreenClass, boolean isOnRightSide);
+ /**
+ * Register an exclusion zone
+ *
+ * @param screenClass the screen
+ * @param supplier the exclusion zone supplier
+ */
void registerExclusionZones(Class<? extends Screen> screenClass, ExclusionZoneSupplier supplier);
public static interface ExclusionZoneSupplier {
+ /**
+ * Gets the current exclusion zones
+ *
+ * @param isOnRightSide whether the user has set the overlay to the right
+ * @return the list of exclusion zones
+ */
List<Rectangle> apply(boolean isOnRightSide);
}
}
diff --git a/src/main/java/me/shedaniel/rei/api/ClientHelper.java b/src/main/java/me/shedaniel/rei/api/ClientHelper.java
index fe33ddc64..d9f6c7ae8 100644
--- a/src/main/java/me/shedaniel/rei/api/ClientHelper.java
+++ b/src/main/java/me/shedaniel/rei/api/ClientHelper.java
@@ -41,9 +41,9 @@ public interface ClientHelper {
/**
* 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
+ * Opens {@link me.shedaniel.rei.gui.PreRecipeViewingScreen} if not set
+ * Opens {@link me.shedaniel.rei.gui.RecipeViewingScreen} if set to default
+ * Opens {@link me.shedaniel.rei.gui.VillagerRecipeViewingScreen} if set to villager
*
* @param map the map of recipes
*/
@@ -115,14 +115,29 @@ public interface ClientHelper {
*/
String getModFromIdentifier(Identifier identifier);
+ /**
+ * @return the recipe keybind, defaulted R
+ */
FabricKeyBinding getRecipeKeyBinding();
+ /**
+ * @return the usage keybind, defaulted U
+ */
FabricKeyBinding getUsageKeyBinding();
+ /**
+ * @return the hide keybind, defaulted O
+ */
FabricKeyBinding getHideKeyBinding();
+ /**
+ * @return the previous page keybind, defaulted not set
+ */
FabricKeyBinding getPreviousPageKeyBinding();
+ /**
+ * @return the next page keybind, defaulted not set
+ */
FabricKeyBinding getNextPageKeyBinding();
/**
diff --git a/src/main/java/me/shedaniel/rei/api/DisplayHelper.java b/src/main/java/me/shedaniel/rei/api/DisplayHelper.java
index 9fea85839..5cabf4ad1 100644
--- a/src/main/java/me/shedaniel/rei/api/DisplayHelper.java
+++ b/src/main/java/me/shedaniel/rei/api/DisplayHelper.java
@@ -56,11 +56,6 @@ public interface DisplayHelper {
public static interface DisplayBoundsHandler<T> {
/**
- * An empty rectangle
- */
- public static final Rectangle EMPTY = new Rectangle();
-
- /**
* Gets the base supported class for the bounds handler
*
* @return the base class
diff --git a/src/main/java/me/shedaniel/rei/api/ItemRegistry.java b/src/main/java/me/shedaniel/rei/api/ItemRegistry.java
index 0a9da2c46..a29682985 100644
--- a/src/main/java/me/shedaniel/rei/api/ItemRegistry.java
+++ b/src/main/java/me/shedaniel/rei/api/ItemRegistry.java
@@ -27,6 +27,12 @@ public interface ItemRegistry {
@Deprecated
List<ItemStack> getModifiableItemList();
+ /**
+ * Gets all possible stacks from an item
+ *
+ * @param item the item to find
+ * @return the array of possible stacks
+ */
ItemStack[] getAllStacksFromItem(Item item);
/**
@@ -37,12 +43,23 @@ public interface ItemRegistry {
*/
void registerItemStack(Item afterItem, ItemStack stack);
+ /**
+ * Registers multiple stacks to the item list
+ *
+ * @param afterItem the stack to put after
+ * @param stacks the stacks to register
+ */
default void registerItemStack(Item afterItem, ItemStack... stacks) {
for(ItemStack stack : stacks)
if (stack != null && !stack.isEmpty())
registerItemStack(afterItem, stack);
}
+ /**
+ * Registers multiple stacks to the item list
+ *
+ * @param stacks the stacks to register
+ */
default void registerItemStack(ItemStack... stacks) {
for(ItemStack stack : stacks)
if (stack != null && !stack.isEmpty())
diff --git a/src/main/java/me/shedaniel/rei/api/PluginDisabler.java b/src/main/java/me/shedaniel/rei/api/PluginDisabler.java
index cd3b61578..ed4f8638c 100644
--- a/src/main/java/me/shedaniel/rei/api/PluginDisabler.java
+++ b/src/main/java/me/shedaniel/rei/api/PluginDisabler.java
@@ -9,20 +9,51 @@ import net.minecraft.util.Identifier;
public interface PluginDisabler {
+ /**
+ * Disables multiple functions from a plugin
+ *
+ * @param plugin the identifier of the plugin
+ * @param functions the array of functions to be disabled
+ */
default void disablePluginFunctions(Identifier plugin, PluginFunction... functions) {
for(PluginFunction function : functions)
disablePluginFunction(plugin, function);
}
+ /**
+ * Enables multiple functions from a plugin
+ *
+ * @param plugin the identifier of the plugin
+ * @param functions the array of functions to be enabled
+ */
default void enablePluginFunctions(Identifier plugin, PluginFunction... functions) {
for(PluginFunction function : functions)
enablePluginFunction(plugin, function);
}
+ /**
+ * Disables a function from a plugin
+ *
+ * @param plugin the identifier of the plugin
+ * @param function the function to be disabled
+ */
void disablePluginFunction(Identifier plugin, PluginFunction function);
+ /**
+ * Enables a function from a plugin
+ *
+ * @param plugin the identifier of the plugin
+ * @param function the function to be enabled
+ */
void enablePluginFunction(Identifier plugin, PluginFunction function);
+ /**
+ * Checks if a plugin function has been disabled
+ *
+ * @param plugin the identifier of the plugin
+ * @param function the function to check
+ * @return whether if it has been disabled
+ */
boolean isFunctionEnabled(Identifier plugin, PluginFunction function);
}
diff --git a/src/main/java/me/shedaniel/rei/api/RecipeDisplay.java b/src/main/java/me/shedaniel/rei/api/RecipeDisplay.java
index 4fb564133..9e17159bc 100644
--- a/src/main/java/me/shedaniel/rei/api/RecipeDisplay.java
+++ b/src/main/java/me/shedaniel/rei/api/RecipeDisplay.java
@@ -15,16 +15,35 @@ import java.util.Optional;
public interface RecipeDisplay<T extends Recipe> {
+ /**
+ * @return the optional recipe
+ */
Optional<T> getRecipe();
+ /**
+ * @return a list of items
+ */
List<List<ItemStack>> getInput();
+ /**
+ * @return a list of outputs
+ */
List<ItemStack> getOutput();
+ /**
+ * Gets the required items used in craftable filters
+ *
+ * @return the list of required items
+ */
default List<List<ItemStack>> getRequiredItems() {
return Lists.newArrayList();
}
+ /**
+ * Gets the recipe display category identifier
+ *
+ * @return the identifier of the category
+ */
Identifier getRecipeCategory();
}
diff --git a/src/main/java/me/shedaniel/rei/api/RecipeHelper.java b/src/main/java/me/shedaniel/rei/api/RecipeHelper.java
index 58d67e97a..acb844e2e 100644
--- a/src/main/java/me/shedaniel/rei/api/RecipeHelper.java
+++ b/src/main/java/me/shedaniel/rei/api/RecipeHelper.java
@@ -24,10 +24,24 @@ public interface RecipeHelper {
return RoughlyEnoughItemsCore.getRecipeHelper();
}
+ /**
+ * Gets the total recipe count registered
+ *
+ * @return the recipe count
+ */
int getRecipeCount();
- List<Recipe> getVanillaSortedRecipes();
+ /**
+ * @return a list of sorted recipes
+ */
+ List<Recipe> getAllSortedRecipes();
+ /**
+ * Gets all craftable items from materials.
+ *
+ * @param inventoryItems the materials
+ * @return the list of craftable items
+ */
List<ItemStack> findCraftableByItems(List<ItemStack> inventoryItems);
/**
@@ -45,6 +59,12 @@ public interface RecipeHelper {
*/
void registerDisplay(Identifier categoryIdentifier, RecipeDisplay display);
+ /**
+ * Gets a map of recipes for an itemstack
+ *
+ * @param stack the stack to be crafted
+ * @return the map of recipes
+ */
Map<RecipeCategory, List<RecipeDisplay>> getRecipesFor(ItemStack stack);
/**
@@ -56,32 +76,101 @@ public interface RecipeHelper {
/**
* Gets all registered categories
+ *
* @return the list of categories
*/
List<RecipeCategory> getAllCategories();
+ /**
+ * Gets a map of usages for an itemstack
+ *
+ * @param stack the stack to be used
+ * @return the map of recipes
+ */
Map<RecipeCategory, List<RecipeDisplay>> getUsagesFor(ItemStack stack);
+ /**
+ * Gets the optional of the speed crafting button area from a category
+ *
+ * @param category the category of the display
+ * @return the optional of speed crafting button area
+ */
Optional<ButtonAreaSupplier> getSpeedCraftButtonArea(RecipeCategory category);
+ /**
+ * Registers a speed crafting button area
+ *
+ * @param category the category of the button area
+ * @param rectangle the button area
+ */
void registerSpeedCraftButtonArea(Identifier category, ButtonAreaSupplier rectangle);
+ /**
+ * Registers a default speed crafting button area, which is bottom right
+ *
+ * @param category the category of the button area
+ */
void registerDefaultSpeedCraftButtonArea(Identifier category);
+ /**
+ * Gets the speed crafting functional from a category
+ *
+ * @param category the category of the speed crafting functional
+ * @return the list of speed crafting functionals
+ */
List<SpeedCraftFunctional> getSpeedCraftFunctional(RecipeCategory category);
+ /**
+ * Registers a speed crafting functional
+ *
+ * @param category the category of the speed crafting functional
+ * @param functional the functional to be registered
+ */
void registerSpeedCraftFunctional(Identifier category, SpeedCraftFunctional functional);
+ /**
+ * Gets the map of all recipes visible to the player
+ *
+ * @return the map of recipes
+ */
Map<RecipeCategory, List<RecipeDisplay>> getAllRecipes();
+ /**
+ * Registers a recipe visibility handler
+ *
+ * @param visibilityHandler the handler to be registered
+ */
void registerRecipeVisibilityHandler(DisplayVisibilityHandler visibilityHandler);
+ /**
+ * Unregisters a recipe visibility handler
+ *
+ * @param visibilityHandler the handler to be unregistered
+ */
void unregisterRecipeVisibilityHandler(DisplayVisibilityHandler visibilityHandler);
+ /**
+ * Gets an unmodifiable list of recipe visibility handlers
+ *
+ * @return the unmodifiable list of handlers
+ */
List<DisplayVisibilityHandler> getDisplayVisibilityHandlers();
+ /**
+ * Checks if the display is visible by asking recipe visibility handlers
+ *
+ * @param display the display to be checked
+ * @param respectConfig whether it should respect the user's config
+ * @return whether the display should be visible
+ */
boolean isDisplayVisible(RecipeDisplay display, boolean respectConfig);
+ /**
+ * Gets the cached category setting by the category identifier
+ *
+ * @param category the identifier of the category
+ * @return the optional of the category settings
+ */
Optional<DisplaySettings> getCachedCategorySettings(Identifier category);
}
diff --git a/src/main/java/me/shedaniel/rei/api/Renderable.java b/src/main/java/me/shedaniel/rei/api/Renderable.java
index 47b8f4beb..75d9161be 100644
--- a/src/main/java/me/shedaniel/rei/api/Renderable.java
+++ b/src/main/java/me/shedaniel/rei/api/Renderable.java
@@ -19,6 +19,12 @@ import java.util.function.Supplier;
*/
public interface Renderable {
+ /**
+ * Gets an item stack renderer by an item stack supplier
+ *
+ * @param supplier the supplier for getting the item stack
+ * @return the item stack renderer
+ */
static ItemStackRenderer fromItemStackSupplier(Supplier<ItemStack> supplier) {
return new ItemStackRenderer() {
@Override
@@ -28,19 +34,32 @@ public interface Renderable {
};
}
+ /**
+ * Gets an item stack renderer by an item stack
+ *
+ * @param stack the item stack to be displayed
+ * @return the item stack renderer
+ */
static ItemStackRenderer fromItemStack(ItemStack stack) {
- return new ItemStackRenderer() {
- @Override
- public ItemStack getItemStack() {
- return stack;
- }
- };
+ return fromItemStackSupplier(() -> stack);
}
+ /**
+ * Gets an empty renderer
+ *
+ * @return an empty renderer
+ */
static EmptyRenderer empty() {
return EmptyRenderer.INSTANCE;
}
+ /**
+ * Gets a simple recipe renderer from inputs and outputs
+ *
+ * @param input the list of input items
+ * @param output the list of output items
+ * @return the recipe renderer
+ */
static SimpleRecipeRenderer fromRecipe(Supplier<List<List<ItemStack>>> input, Supplier<List<ItemStack>> output) {
return new SimpleRecipeRenderer(input, output);
}
@@ -56,5 +75,14 @@ public interface Renderable {
};
}
+ /**
+ * Renders of the renderable
+ *
+ * @param x the x coordinate of the renderable
+ * @param y the y coordinate of the renderable
+ * @param mouseX the x coordinate of the mouse
+ * @param mouseY the y coordinate of the mouse
+ * @param delta the delta
+ */
void render(int x, int y, double mouseX, double mouseY, float delta);
}
diff --git a/src/main/java/me/shedaniel/rei/api/Renderer.java b/src/main/java/me/shedaniel/rei/api/Renderer.java
index c94fd2631..aada00b8a 100644
--- a/src/main/java/me/shedaniel/rei/api/Renderer.java
+++ b/src/main/java/me/shedaniel/rei/api/Renderer.java
@@ -8,10 +8,20 @@ package me.shedaniel.rei.api;
import net.minecraft.client.gui.DrawableHelper;
public abstract class Renderer extends DrawableHelper implements Renderable {
+ /**
+ * Gets the current blit offset
+ *
+ * @return the blit offset
+ */
public int getBlitOffset() {
return this.blitOffset;
}
+ /**
+ * Sets the current blit offset
+ *
+ * @param offset the new blit offset
+ */
public void setBlitOffset(int offset) {
this.blitOffset = offset;
}
diff --git a/src/main/java/me/shedaniel/rei/api/SpeedCraftFunctional.java b/src/main/java/me/shedaniel/rei/api/SpeedCraftFunctional.java
index cec75d282..6824883a3 100644
--- a/src/main/java/me/shedaniel/rei/api/SpeedCraftFunctional.java
+++ b/src/main/java/me/shedaniel/rei/api/SpeedCraftFunctional.java
@@ -9,10 +9,29 @@ import net.minecraft.client.gui.Screen;
public interface SpeedCraftFunctional<T extends RecipeDisplay> {
+ /**
+ * Gets the classes that it is functioning for
+ *
+ * @return the array of classes
+ */
Class[] getFunctioningFor();
+ /**
+ * Performs the auto crafting
+ *
+ * @param screen the current screen
+ * @param recipe the current recipe
+ * @return whether it worked
+ */
boolean performAutoCraft(Screen screen, T recipe);
+ /**
+ * Gets if this functional accepts the auto crafting
+ *
+ * @param screen the current screen
+ * @param recipe the current recipe
+ * @return whether it is accepted
+ */
boolean acceptRecipe(Screen screen, T recipe);
}