aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/me/shedaniel/rei/client/RecipeHelperImpl.java
diff options
context:
space:
mode:
authorUnknown <shekwancheung0528@gmail.com>2019-04-11 21:47:51 +0800
committerUnknown <shekwancheung0528@gmail.com>2019-04-11 21:47:51 +0800
commit41998600e53f941554c8d73790180c13a2e5663c (patch)
treef068c4e7c0f5a5f32a4d614b5f75bd4704c9e888 /src/main/java/me/shedaniel/rei/client/RecipeHelperImpl.java
parent6c783c00640143c810c81486e0c49003b297221f (diff)
downloadRoughlyEnoughItems-41998600e53f941554c8d73790180c13a2e5663c.tar.gz
RoughlyEnoughItems-41998600e53f941554c8d73790180c13a2e5663c.tar.bz2
RoughlyEnoughItems-41998600e53f941554c8d73790180c13a2e5663c.zip
2.7.2
Diffstat (limited to 'src/main/java/me/shedaniel/rei/client/RecipeHelperImpl.java')
-rw-r--r--src/main/java/me/shedaniel/rei/client/RecipeHelperImpl.java11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/main/java/me/shedaniel/rei/client/RecipeHelperImpl.java b/src/main/java/me/shedaniel/rei/client/RecipeHelperImpl.java
index 161bdd5ae..05cfa4299 100644
--- a/src/main/java/me/shedaniel/rei/client/RecipeHelperImpl.java
+++ b/src/main/java/me/shedaniel/rei/client/RecipeHelperImpl.java
@@ -23,6 +23,7 @@ public class RecipeHelperImpl implements RecipeHelper {
}).reversed();
private final AtomicInteger recipeCount = new AtomicInteger();
private final Map<Identifier, List<RecipeDisplay>> recipeCategoryListMap = Maps.newHashMap();
+ private final Map<Identifier, DisplaySettings> categoryDisplaySettingsMap = Maps.newHashMap();
private final List<RecipeCategory> categories = Lists.newArrayList();
private final Map<Identifier, ButtonAreaSupplier> speedCraftAreaSupplierMap = Maps.newHashMap();
private final Map<Identifier, List<SpeedCraftFunctional>> speedCraftFunctionalMap = Maps.newHashMap();
@@ -62,6 +63,7 @@ public class RecipeHelperImpl implements RecipeHelper {
@Override
public void registerCategory(RecipeCategory category) {
categories.add(category);
+ categoryDisplaySettingsMap.put(category.getIdentifier(), category.getDisplaySettings());
recipeCategoryListMap.put(category.getIdentifier(), Lists.newLinkedList());
}
@@ -180,7 +182,9 @@ public class RecipeHelperImpl implements RecipeHelper {
this.categories.clear();
this.speedCraftAreaSupplierMap.clear();
this.speedCraftFunctionalMap.clear();
+ this.categoryDisplaySettingsMap.clear();
this.displayVisibilityHandlers.clear();
+ ((DisplayHelperImpl) RoughlyEnoughItemsCore.getDisplayHelper()).resetCache();
long startTime = System.currentTimeMillis();
List<REIPlugin> plugins = new LinkedList<>(RoughlyEnoughItemsCore.getPlugins());
plugins.sort((first, second) -> {
@@ -202,6 +206,8 @@ public class RecipeHelperImpl implements RecipeHelper {
plugin.registerRecipeDisplays(this);
if (RoughlyEnoughItemsCore.getConfigManager().getConfig().enableLegacySpeedCraftSupport && pluginDisabler.isFunctionEnabled(identifier, PluginFunction.REGISTER_SPEED_CRAFT))
plugin.registerSpeedCraft(this);
+ if (pluginDisabler.isFunctionEnabled(identifier, PluginFunction.REGISTER_BOUNDS))
+ plugin.registerBounds(RoughlyEnoughItemsCore.getDisplayHelper());
if (pluginDisabler.isFunctionEnabled(identifier, PluginFunction.REGISTER_OTHERS))
plugin.registerOthers(this);
});
@@ -272,4 +278,9 @@ public class RecipeHelperImpl implements RecipeHelper {
return true;
}
+ @Override
+ public Optional<DisplaySettings> getCachedCategorySettings(Identifier category) {
+ return categoryDisplaySettingsMap.entrySet().stream().filter(entry -> entry.getKey().equals(category)).map(Map.Entry::getValue).findAny();
+ }
+
}