Skip to content
Permalink
Browse files

Remove ingredient lookup memory

  • Loading branch information...
mezz committed Aug 7, 2017
1 parent 6fe23ac commit dfc43f8862bbb533732cd789e475ef04c2e259c0
@@ -5,7 +5,6 @@
import com.google.common.base.Preconditions;
import mezz.jei.color.ColorNamer;
import mezz.jei.gui.GuiEventHandler;
import mezz.jei.gui.ingredients.IngredientLookupMemory;
import mezz.jei.ingredients.IngredientFilter;
import mezz.jei.ingredients.IngredientRegistry;
import mezz.jei.runtime.JeiHelpers;
@@ -28,8 +27,6 @@
@Nullable
private static ColorNamer colorNamer;
@Nullable
private static IngredientLookupMemory ingredientLookupMemory;
@Nullable
private static IngredientFilter ingredientFilter;
@Nullable
private static GuiEventHandler guiEventHandler;
@@ -87,15 +84,6 @@ public static void setColorNamer(ColorNamer colorNamer) {
Internal.colorNamer = colorNamer;
}

public static IngredientLookupMemory getIngredientLookupMemory() {
Preconditions.checkState(ingredientLookupMemory != null, "Ingredient Lookup Memory has not been created yet.");
return ingredientLookupMemory;
}

public static void setIngredientLookupMemory(IngredientLookupMemory ingredientLookupMemory) {
Internal.ingredientLookupMemory = ingredientLookupMemory;
}

public static IngredientFilter getIngredientFilter() {
Preconditions.checkState(ingredientFilter != null, "Ingredient Filter has not been created yet.");
return ingredientFilter;
@@ -2,7 +2,6 @@

import javax.annotation.Nullable;

import mezz.jei.Internal;
import mezz.jei.config.Config;
import mezz.jei.config.OverlayToggleEvent;
import mezz.jei.gui.overlay.IngredientListOverlay;
@@ -59,7 +58,6 @@ public void onGuiOpen(GuiOpenEvent event) {

if (wasEnabled && !ingredientListOverlay.isEnabled()) {
Config.saveFilterText();
Internal.getIngredientLookupMemory().saveToFile();
}
}

@@ -5,7 +5,6 @@

import com.google.common.base.Preconditions;
import com.google.common.collect.ImmutableList;
import mezz.jei.Internal;
import mezz.jei.api.recipe.IFocus;
import mezz.jei.api.recipe.IRecipeCategory;
import mezz.jei.gui.Focus;
@@ -48,7 +47,6 @@ public int getRecipeCategoryIndex() {

public void setRecipeCategoryIndex(int recipeCategoryIndex) {
this.recipeCategoryIndex = recipeCategoryIndex;
Internal.getIngredientLookupMemory().markDirty();
}

public int getRecipeIndex() {
@@ -57,7 +55,6 @@ public int getRecipeIndex() {

public void setRecipeIndex(int recipeIndex) {
this.recipeIndex = recipeIndex;
Internal.getIngredientLookupMemory().markDirty();
}

public int getRecipesPerPage() {
@@ -47,7 +47,7 @@ public RecipeGuiLogic(IRecipeRegistry recipeRegistry, IRecipeLogicStateListener
history.push(this.state);
}

final IngredientLookupState state = Internal.getIngredientLookupMemory().getState(focus, recipeCategories);
IngredientLookupState state = new IngredientLookupState(focus, recipeCategories, 0, 0);
setState(state);

return true;
@@ -9,7 +9,6 @@
import mezz.jei.api.gui.IAdvancedGuiHandler;
import mezz.jei.gui.GuiEventHandler;
import mezz.jei.gui.ingredients.IIngredientListElement;
import mezz.jei.gui.ingredients.IngredientLookupMemory;
import mezz.jei.gui.overlay.IngredientListOverlay;
import mezz.jei.gui.recipes.RecipesGui;
import mezz.jei.ingredients.IngredientFilter;
@@ -54,11 +53,6 @@ public void start(List<IModPlugin> plugins) {
RecipeRegistry recipeRegistry = modRegistry.createRecipeRegistry(ingredientRegistry);
Log.info("Built recipe registry in {} ms", System.currentTimeMillis() - start_time);

Log.info("Loading ingredient lookup history...");
start_time = System.currentTimeMillis();
Internal.setIngredientLookupMemory(new IngredientLookupMemory(recipeRegistry, ingredientRegistry));
Log.info("Loaded ingredient lookup history in {} ms", System.currentTimeMillis() - start_time);

Log.info("Building ingredient list...");
start_time = System.currentTimeMillis();
List<IIngredientListElement> ingredientList = IngredientListElementFactory.createBaseList(ingredientRegistry, ForgeModIdHelper.getInstance());
@@ -177,11 +177,6 @@ public void onWorldSave(WorldEvent.Save event) {
} catch (RuntimeException e) {
Log.error("Failed to save filter text.", e);
}
try {
Internal.getIngredientLookupMemory().saveToFile();
} catch (RuntimeException e) {
Log.error("Failed to save ingredient lookup memory.", e);
}
}

@SubscribeEvent

0 comments on commit dfc43f8

Please sign in to comment.
You can’t perform that action at this time.