aboutsummaryrefslogtreecommitdiff
path: root/RoughlyEnoughItems-api/src/main/java/me/shedaniel/rei/api/RecipeHelper.java
diff options
context:
space:
mode:
authorshedaniel <daniel@shedaniel.me>2020-12-14 00:10:26 +0800
committershedaniel <daniel@shedaniel.me>2020-12-14 00:10:26 +0800
commit1f6137d24153b62c42da129ce5d6373bbf78ee34 (patch)
tree75ae34e8a1db21e08253a3fc424a8989abd20d9f /RoughlyEnoughItems-api/src/main/java/me/shedaniel/rei/api/RecipeHelper.java
parent90b8a8181eb7e642fb88832f8bd8baa3acdcf804 (diff)
downloadRoughlyEnoughItems-1f6137d24153b62c42da129ce5d6373bbf78ee34.tar.gz
RoughlyEnoughItems-1f6137d24153b62c42da129ce5d6373bbf78ee34.tar.bz2
RoughlyEnoughItems-1f6137d24153b62c42da129ce5d6373bbf78ee34.zip
The big refactor
Signed-off-by: shedaniel <daniel@shedaniel.me>
Diffstat (limited to 'RoughlyEnoughItems-api/src/main/java/me/shedaniel/rei/api/RecipeHelper.java')
-rw-r--r--RoughlyEnoughItems-api/src/main/java/me/shedaniel/rei/api/RecipeHelper.java28
1 files changed, 14 insertions, 14 deletions
diff --git a/RoughlyEnoughItems-api/src/main/java/me/shedaniel/rei/api/RecipeHelper.java b/RoughlyEnoughItems-api/src/main/java/me/shedaniel/rei/api/RecipeHelper.java
index b0c61e380..74351ceda 100644
--- a/RoughlyEnoughItems-api/src/main/java/me/shedaniel/rei/api/RecipeHelper.java
+++ b/RoughlyEnoughItems-api/src/main/java/me/shedaniel/rei/api/RecipeHelper.java
@@ -59,7 +59,7 @@ public interface RecipeHelper {
@Nullable
@ApiStatus.Internal
- EntryStack getScreenFocusedStack(Screen screen);
+ EntryStack<?> getScreenFocusedStack(Screen screen);
List<AutoTransferHandler> getSortedAutoCraftingHandler();
@@ -73,7 +73,7 @@ public interface RecipeHelper {
/**
* @return a list of sorted recipes
*/
- List<Recipe> getAllSortedRecipes();
+ List<Recipe<?>> getAllSortedRecipes();
/**
* Gets all craftable items from materials.
@@ -81,7 +81,7 @@ public interface RecipeHelper {
* @param inventoryItems the materials
* @return the list of craftable entries
*/
- List<EntryStack> findCraftableEntriesByItems(Iterable<EntryStack> inventoryItems);
+ List<EntryStack<?>> findCraftableEntriesByItems(Iterable<? extends EntryStack<?>> inventoryItems);
/**
* Gets all craftable items from materials.
@@ -89,8 +89,8 @@ public interface RecipeHelper {
* @param inventoryItems the materials
* @return the list of craftable entries
*/
- default List<EntryStack> findCraftableEntriesByItems(List<EntryStack> inventoryItems) {
- return findCraftableEntriesByItems((Iterable<EntryStack>) inventoryItems);
+ default List<EntryStack<?>> findCraftableEntriesByItems(List<? extends EntryStack<?>> inventoryItems) {
+ return findCraftableEntriesByItems((Iterable<? extends EntryStack<?>>) inventoryItems);
}
/**
@@ -118,7 +118,7 @@ public interface RecipeHelper {
* @param category the category
* @param workingStations the working stations
*/
- void registerWorkingStations(ResourceLocation category, List<EntryStack>... workingStations);
+ void registerWorkingStations(ResourceLocation category, List<? extends EntryStack<?>>... workingStations);
/**
* Registers the working stations of a category
@@ -126,9 +126,9 @@ public interface RecipeHelper {
* @param category the category
* @param workingStations the working stations
*/
- void registerWorkingStations(ResourceLocation category, EntryStack... workingStations);
+ void registerWorkingStations(ResourceLocation category, EntryStack<?>... workingStations);
- List<List<EntryStack>> getWorkingStations(ResourceLocation category);
+ List<List<? extends EntryStack<?>>> getWorkingStations(ResourceLocation category);
/**
* Registers a recipe display.
@@ -145,7 +145,7 @@ public interface RecipeHelper {
* @param stack the stack to be crafted
* @return the map of recipes
*/
- Map<RecipeCategory<?>, List<RecipeDisplay>> getRecipesFor(EntryStack stack);
+ Map<RecipeCategory<?>, List<RecipeDisplay>> getRecipesFor(EntryStack<?> stack);
RecipeCategory<?> getCategory(ResourceLocation identifier);
@@ -169,7 +169,7 @@ public interface RecipeHelper {
* @param stack the stack to be used
* @return the map of recipes
*/
- Map<RecipeCategory<?>, List<RecipeDisplay>> getUsagesFor(EntryStack stack);
+ Map<RecipeCategory<?>, List<RecipeDisplay>> getUsagesFor(EntryStack<?> stack);
/**
* Gets the optional of the auto crafting button area from a category
@@ -238,8 +238,6 @@ public interface RecipeHelper {
*/
boolean isDisplayVisible(RecipeDisplay display);
- <T extends Recipe<?>> void registerRecipes(ResourceLocation category, Predicate<Recipe> recipeFilter, Function<T, RecipeDisplay> mappingFunction);
-
/**
* Registers a live recipe generator.
*
@@ -290,9 +288,11 @@ public interface RecipeHelper {
*/
<T extends Screen> void registerClickArea(Class<T> screenClass, ClickAreaHandler<T> handler);
- <T extends Recipe<?>> void registerRecipes(ResourceLocation category, Class<T> recipeClass, Function<T, RecipeDisplay> mappingFunction);
+ default <T extends Recipe<?>> void registerRecipes(ResourceLocation category, Class<T> recipeClass, Function<T, RecipeDisplay> mappingFunction) {
+ registerRecipes(category, recipe -> recipeClass.isAssignableFrom(recipe.getClass()), mappingFunction);
+ }
- <T extends Recipe<?>> void registerRecipes(ResourceLocation category, Function<Recipe, Boolean> recipeFilter, Function<T, RecipeDisplay> mappingFunction);
+ <T extends Recipe<?>> void registerRecipes(ResourceLocation category, Predicate<Recipe<?>> recipeFilter, Function<T, RecipeDisplay> mappingFunction);
@ApiStatus.Internal
boolean arePluginsLoading();