aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/me/shedaniel/rei/client/RecipeHelperImpl.java
diff options
context:
space:
mode:
authorUnknown <shekwancheung0528@gmail.com>2019-06-07 12:09:48 +0800
committerUnknown <shekwancheung0528@gmail.com>2019-06-07 12:09:48 +0800
commit6fdbd7b5581a1536e644517987c3ba5e631f5c1d (patch)
tree71d5b6ec17e88c5a7bafb5b529d4864b7a2be452 /src/main/java/me/shedaniel/rei/client/RecipeHelperImpl.java
parent1f5ab59c04dd04918131c3d3942057e1969277c5 (diff)
downloadRoughlyEnoughItems-6fdbd7b5581a1536e644517987c3ba5e631f5c1d.tar.gz
RoughlyEnoughItems-6fdbd7b5581a1536e644517987c3ba5e631f5c1d.tar.bz2
RoughlyEnoughItems-6fdbd7b5581a1536e644517987c3ba5e631f5c1d.zip
2.9.4
Diffstat (limited to 'src/main/java/me/shedaniel/rei/client/RecipeHelperImpl.java')
-rw-r--r--src/main/java/me/shedaniel/rei/client/RecipeHelperImpl.java13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/main/java/me/shedaniel/rei/client/RecipeHelperImpl.java b/src/main/java/me/shedaniel/rei/client/RecipeHelperImpl.java
index 7f4a0ee80..83ee91458 100644
--- a/src/main/java/me/shedaniel/rei/client/RecipeHelperImpl.java
+++ b/src/main/java/me/shedaniel/rei/client/RecipeHelperImpl.java
@@ -19,6 +19,7 @@ import java.util.List;
import java.util.*;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.function.Function;
+import java.util.function.Predicate;
import java.util.stream.Collectors;
public class RecipeHelperImpl implements RecipeHelper {
@@ -204,6 +205,7 @@ public class RecipeHelperImpl implements RecipeHelper {
speedCraftAreaSupplierMap.put(category, rectangle);
}
+ @SuppressWarnings("deprecation")
@Override
public void registerDefaultSpeedCraftButtonArea(Identifier category) {
registerSpeedCraftButtonArea(category, bounds -> new Rectangle((int) bounds.getMaxX() - 16, (int) bounds.getMaxY() - 16, 10, 10));
@@ -271,7 +273,7 @@ public class RecipeHelperImpl implements RecipeHelper {
Collections.reverse(allSortedRecipes);
recipeFunctions.forEach(recipeFunction -> {
try {
- allSortedRecipes.stream().filter(recipe -> recipeFunction.recipeFilter.apply(recipe)).forEach(t -> registerDisplay(recipeFunction.category, (RecipeDisplay) recipeFunction.mappingFunction.apply(t), 0));
+ allSortedRecipes.stream().filter(recipe -> recipeFunction.recipeFilter.test(recipe)).forEach(t -> registerDisplay(recipeFunction.category, (RecipeDisplay) recipeFunction.mappingFunction.apply(t), 0));
} catch (Exception e) {
RoughlyEnoughItemsCore.LOGGER.error("[REI] Failed to add recipes!", e);
}
@@ -361,6 +363,11 @@ public class RecipeHelperImpl implements RecipeHelper {
@Override
public <T extends Recipe<?>> void registerRecipes(Identifier category, Function<Recipe, Boolean> recipeFilter, Function<T, RecipeDisplay> mappingFunction) {
+ recipeFunctions.add(new RecipeFunction(category, recipeFilter::apply, mappingFunction));
+ }
+
+ @Override
+ public <T extends Recipe<?>> void registerRecipes(Identifier category, Predicate<Recipe> recipeFilter, Function<T, RecipeDisplay> mappingFunction) {
recipeFunctions.add(new RecipeFunction(category, recipeFilter, mappingFunction));
}
@@ -376,10 +383,10 @@ public class RecipeHelperImpl implements RecipeHelper {
private class RecipeFunction {
Identifier category;
- Function<Recipe, Boolean> recipeFilter;
+ Predicate<Recipe> recipeFilter;
Function mappingFunction;
- public RecipeFunction(Identifier category, Function<Recipe, Boolean> recipeFilter, Function<?, RecipeDisplay> mappingFunction) {
+ public RecipeFunction(Identifier category, Predicate<Recipe> recipeFilter, Function<?, RecipeDisplay> mappingFunction) {
this.category = category;
this.recipeFilter = recipeFilter;
this.mappingFunction = mappingFunction;