aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/me
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/me')
-rw-r--r--src/main/java/me/shedaniel/rei/api/DisplayVisibility.java2
-rw-r--r--src/main/java/me/shedaniel/rei/api/DisplayVisibilityHandler.java1
-rw-r--r--src/main/java/me/shedaniel/rei/api/RecipeHelper.java10
-rw-r--r--src/main/java/me/shedaniel/rei/client/ConfigObject.java2
-rw-r--r--src/main/java/me/shedaniel/rei/client/RecipeHelperImpl.java20
-rw-r--r--src/main/java/me/shedaniel/rei/utils/ClothScreenRegistry.java1
6 files changed, 23 insertions, 13 deletions
diff --git a/src/main/java/me/shedaniel/rei/api/DisplayVisibility.java b/src/main/java/me/shedaniel/rei/api/DisplayVisibility.java
index 8f1149e26..0bfdb024c 100644
--- a/src/main/java/me/shedaniel/rei/api/DisplayVisibility.java
+++ b/src/main/java/me/shedaniel/rei/api/DisplayVisibility.java
@@ -7,7 +7,7 @@ package me.shedaniel.rei.api;
public enum DisplayVisibility {
ALWAYS_VISIBLE,
- CONFIG_OPTIONAL,
+ @Deprecated CONFIG_OPTIONAL,
NEVER_VISIBLE,
PASS
}
diff --git a/src/main/java/me/shedaniel/rei/api/DisplayVisibilityHandler.java b/src/main/java/me/shedaniel/rei/api/DisplayVisibilityHandler.java
index 8f6156891..429306ff2 100644
--- a/src/main/java/me/shedaniel/rei/api/DisplayVisibilityHandler.java
+++ b/src/main/java/me/shedaniel/rei/api/DisplayVisibilityHandler.java
@@ -20,7 +20,6 @@ public interface DisplayVisibilityHandler {
* 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
diff --git a/src/main/java/me/shedaniel/rei/api/RecipeHelper.java b/src/main/java/me/shedaniel/rei/api/RecipeHelper.java
index a57b7146f..5a5c1b4a2 100644
--- a/src/main/java/me/shedaniel/rei/api/RecipeHelper.java
+++ b/src/main/java/me/shedaniel/rei/api/RecipeHelper.java
@@ -162,10 +162,20 @@ public interface RecipeHelper {
* @param display the display to be checked
* @param respectConfig whether it should respect the user's config
* @return whether the display should be visible
+ * @deprecated {@link RecipeHelper#isDisplayVisible(RecipeDisplay)} )}
*/
+ @Deprecated
boolean isDisplayVisible(RecipeDisplay display, boolean respectConfig);
/**
+ * Checks if the display is visible by asking recipe visibility handlers
+ *
+ * @param display the display to be checked
+ * @return whether the display should be visible
+ */
+ boolean isDisplayVisible(RecipeDisplay display);
+
+ /**
* Gets the cached category setting by the category identifier
*
* @param category the identifier of the category
diff --git a/src/main/java/me/shedaniel/rei/client/ConfigObject.java b/src/main/java/me/shedaniel/rei/client/ConfigObject.java
index 4cde9df00..7b490bc52 100644
--- a/src/main/java/me/shedaniel/rei/client/ConfigObject.java
+++ b/src/main/java/me/shedaniel/rei/client/ConfigObject.java
@@ -42,8 +42,6 @@ public class ConfigObject {
@Comment("Disable Recipe Book") public boolean disableRecipeBook = false;
- public boolean preferVisibleRecipes = false;
-
@Comment("Force enable 2019 REI April Fools' joke") public boolean aprilFoolsFish2019 = false;
public ItemCheatingMode itemCheatingMode = ItemCheatingMode.REI_LIKE;
diff --git a/src/main/java/me/shedaniel/rei/client/RecipeHelperImpl.java b/src/main/java/me/shedaniel/rei/client/RecipeHelperImpl.java
index f7891670f..ec922d4c8 100644
--- a/src/main/java/me/shedaniel/rei/client/RecipeHelperImpl.java
+++ b/src/main/java/me/shedaniel/rei/client/RecipeHelperImpl.java
@@ -106,7 +106,7 @@ public class RecipeHelperImpl implements RecipeHelper {
Map<RecipeCategory, List<RecipeDisplay>> recipeCategoryListMap = Maps.newLinkedHashMap();
categories.forEach(category -> {
if (categoriesMap.containsKey(category.getIdentifier()) && !categoriesMap.get(category.getIdentifier()).isEmpty())
- recipeCategoryListMap.put(category, categoriesMap.get(category.getIdentifier()).stream().filter(display -> isDisplayVisible(display, true)).collect(Collectors.toList()));
+ recipeCategoryListMap.put(category, categoriesMap.get(category.getIdentifier()).stream().filter(display -> isDisplayVisible(display)).collect(Collectors.toList()));
});
for(RecipeCategory category : Lists.newArrayList(recipeCategoryListMap.keySet()))
if (recipeCategoryListMap.get(category).isEmpty())
@@ -149,7 +149,7 @@ public class RecipeHelperImpl implements RecipeHelper {
Map<RecipeCategory, List<RecipeDisplay>> recipeCategoryListMap = Maps.newLinkedHashMap();
categories.forEach(category -> {
if (categoriesMap.containsKey(category.getIdentifier()) && !categoriesMap.get(category.getIdentifier()).isEmpty())
- recipeCategoryListMap.put(category, categoriesMap.get(category.getIdentifier()).stream().filter(display -> isDisplayVisible(display, true)).collect(Collectors.toList()));
+ recipeCategoryListMap.put(category, categoriesMap.get(category.getIdentifier()).stream().filter(display -> isDisplayVisible(display)).collect(Collectors.toList()));
});
for(RecipeCategory category : Lists.newArrayList(recipeCategoryListMap.keySet()))
if (recipeCategoryListMap.get(category).isEmpty())
@@ -265,7 +265,7 @@ public class RecipeHelperImpl implements RecipeHelper {
Map<RecipeCategory, List<RecipeDisplay>> map = Maps.newLinkedHashMap();
categories.forEach(recipeCategory -> {
if (recipeCategoryListMap.containsKey(recipeCategory.getIdentifier())) {
- List<RecipeDisplay> list = recipeCategoryListMap.get(recipeCategory.getIdentifier()).stream().filter(display -> isDisplayVisible(display, true)).collect(Collectors.toList());
+ List<RecipeDisplay> list = recipeCategoryListMap.get(recipeCategory.getIdentifier()).stream().filter(display -> isDisplayVisible(display)).collect(Collectors.toList());
if (!list.isEmpty())
map.put(recipeCategory, list);
}
@@ -288,17 +288,21 @@ public class RecipeHelperImpl implements RecipeHelper {
return Collections.unmodifiableList(displayVisibilityHandlers);
}
+ @SuppressWarnings("deprecation")
@Override
public boolean isDisplayVisible(RecipeDisplay display, boolean respectConfig) {
+ return isDisplayVisible(display);
+ }
+
+ @SuppressWarnings("deprecation")
+ @Override
+ public boolean isDisplayVisible(RecipeDisplay display) {
RecipeCategory category = getCategory(display.getRecipeCategory());
List<DisplayVisibilityHandler> list = getDisplayVisibilityHandlers().stream().sorted(VISIBILITY_HANDLER_COMPARATOR).collect(Collectors.toList());
for(DisplayVisibilityHandler displayVisibilityHandler : list) {
DisplayVisibility visibility = displayVisibilityHandler.handleDisplay(category, display);
- if (visibility != DisplayVisibility.PASS) {
- if (visibility == DisplayVisibility.CONFIG_OPTIONAL)
- return RoughlyEnoughItemsCore.getConfigManager().getConfig().preferVisibleRecipes || !respectConfig;
- return visibility == DisplayVisibility.ALWAYS_VISIBLE;
- }
+ if (visibility != DisplayVisibility.PASS)
+ return visibility == DisplayVisibility.ALWAYS_VISIBLE || visibility == DisplayVisibility.CONFIG_OPTIONAL;
}
return true;
}
diff --git a/src/main/java/me/shedaniel/rei/utils/ClothScreenRegistry.java b/src/main/java/me/shedaniel/rei/utils/ClothScreenRegistry.java
index a6780f9c4..683312db5 100644
--- a/src/main/java/me/shedaniel/rei/utils/ClothScreenRegistry.java
+++ b/src/main/java/me/shedaniel/rei/utils/ClothScreenRegistry.java
@@ -66,7 +66,6 @@ public class ClothScreenRegistry {
});
appearance.addOption(new IntegerSliderEntry("text.rei.config.max_recipes_per_page", 2, 99, RoughlyEnoughItemsCore.getConfigManager().getConfig().maxRecipePerPage, RESET, () -> 3, i -> RoughlyEnoughItemsCore.getConfigManager().getConfig().maxRecipePerPage = i, () -> getConfigTooltip("max_recipes_per_page")));
appearance.addOption(new BooleanListEntry("text.rei.config.light_gray_recipe_border", RoughlyEnoughItemsCore.getConfigManager().getConfig().lightGrayRecipeBorder, RESET, () -> false, bool -> RoughlyEnoughItemsCore.getConfigManager().getConfig().lightGrayRecipeBorder = bool, () -> getConfigTooltip("light_gray_recipe_border")));
- appearance.addOption(new BooleanListEntry("text.rei.config.prefer_visible_recipes", RoughlyEnoughItemsCore.getConfigManager().getConfig().preferVisibleRecipes, RESET, () -> false, bool -> RoughlyEnoughItemsCore.getConfigManager().getConfig().preferVisibleRecipes = bool, () -> getConfigTooltip("prefer_visible_recipes")));
ConfigScreenBuilder.CategoryBuilder action = builder.addCategory("text.rei.config.action");
action.addOption(new EnumListEntry<>("text.rei.config.item_cheating_mode", ItemCheatingMode.class, RoughlyEnoughItemsCore.getConfigManager().getConfig().itemCheatingMode, RESET, () -> ItemCheatingMode.REI_LIKE, i -> RoughlyEnoughItemsCore.getConfigManager().getConfig().itemCheatingMode = i, e -> {
return I18n.translate("text.rei.config.item_cheating_mode." + e.name().toLowerCase());