From 45ed37cc8d0088b57cd2605482f471e69e5885f4 Mon Sep 17 00:00:00 2001 From: Unknown Date: Sun, 12 May 2019 16:26:48 +0800 Subject: Update Mappings --- src/main/java/me/shedaniel/rei/api/DisplayHelper.java | 5 ----- 1 file changed, 5 deletions(-) (limited to 'src/main/java/me/shedaniel/rei/api') 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 @@ -55,11 +55,6 @@ public interface DisplayHelper { BaseBoundsHandler getBaseBoundsHandler(); public static interface DisplayBoundsHandler { - /** - * An empty rectangle - */ - public static final Rectangle EMPTY = new Rectangle(); - /** * Gets the base supported class for the bounds handler * -- cgit From a98d9191f1a97925a8a3e2e23c0a07867540a93a Mon Sep 17 00:00:00 2001 From: Unknown Date: Sun, 12 May 2019 18:10:15 +0800 Subject: Out of beta: Build 110 --- .../me/shedaniel/rei/api/BaseBoundsHandler.java | 19 +++++ .../java/me/shedaniel/rei/api/ClientHelper.java | 21 ++++- .../java/me/shedaniel/rei/api/ItemRegistry.java | 17 ++++ .../java/me/shedaniel/rei/api/PluginDisabler.java | 31 ++++++++ .../java/me/shedaniel/rei/api/RecipeDisplay.java | 19 +++++ .../java/me/shedaniel/rei/api/RecipeHelper.java | 91 +++++++++++++++++++++- src/main/java/me/shedaniel/rei/api/Renderable.java | 40 ++++++++-- src/main/java/me/shedaniel/rei/api/Renderer.java | 10 +++ .../me/shedaniel/rei/api/SpeedCraftFunctional.java | 19 +++++ 9 files changed, 257 insertions(+), 10 deletions(-) (limited to 'src/main/java/me/shedaniel/rei/api') 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 { + /** + * 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 getCurrentExclusionZones(Class currentScreenClass, boolean isOnRightSide); + /** + * Register an exclusion zone + * + * @param screenClass the screen + * @param supplier the exclusion zone supplier + */ void registerExclusionZones(Class 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 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/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 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 { + /** + * @return the optional recipe + */ Optional getRecipe(); + /** + * @return a list of items + */ List> getInput(); + /** + * @return a list of outputs + */ List getOutput(); + /** + * Gets the required items used in craftable filters + * + * @return the list of required items + */ default List> 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 getVanillaSortedRecipes(); + /** + * @return a list of sorted recipes + */ + List getAllSortedRecipes(); + /** + * Gets all craftable items from materials. + * + * @param inventoryItems the materials + * @return the list of craftable items + */ List findCraftableByItems(List 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> getRecipesFor(ItemStack stack); /** @@ -56,32 +76,101 @@ public interface RecipeHelper { /** * Gets all registered categories + * * @return the list of categories */ List getAllCategories(); + /** + * Gets a map of usages for an itemstack + * + * @param stack the stack to be used + * @return the map of recipes + */ Map> 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 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 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> 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 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 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 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>> input, Supplier> 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 { + /** + * 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); } -- cgit