Skip to content

Commit

Permalink
Small fix to allow looking up similar items with IRecipeRegistryPlugins
Browse files Browse the repository at this point in the history
  • Loading branch information
mezz committed Oct 1, 2016
1 parent 516ce1d commit d32e879
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 26 deletions.
22 changes: 0 additions & 22 deletions src/main/java/mezz/jei/gui/Focus.java
Expand Up @@ -2,9 +2,6 @@

import javax.annotation.Nullable;

import mezz.jei.Internal;
import mezz.jei.api.ingredients.IIngredientHelper;
import mezz.jei.api.ingredients.IIngredientRegistry;
import mezz.jei.api.recipe.IFocus;

public class Focus<V> implements IFocus<V> {
Expand Down Expand Up @@ -32,23 +29,4 @@ public V getValue() {
public Mode getMode() {
return mode;
}

public static boolean areFocusesEqual(IFocus focus1, IFocus focus2) {
if (focus1.getMode() == focus2.getMode()) {
String uid1 = getUidForFocusValue(focus1);
String uid2 = getUidForFocusValue(focus2);
return uid1.equals(uid2);
}
return false;
}

private static <V> String getUidForFocusValue(IFocus<V> focus) {
V value = focus.getValue();
if (value != null) {
IIngredientRegistry ingredientRegistry = Internal.getIngredientRegistry();
IIngredientHelper<V> ingredientHelper = ingredientRegistry.getIngredientHelper(value);
return ingredientHelper.getUniqueId(value);
}
return "null";
}
}
4 changes: 0 additions & 4 deletions src/main/java/mezz/jei/gui/RecipeGuiLogic.java
Expand Up @@ -84,10 +84,6 @@ public void clearHistory() {
}

private <V> boolean setFocus(IFocus<V> focus, boolean saveHistory) {
if (this.state != null && Focus.areFocusesEqual(this.state.focus, focus)) {
return true;
}

final List<IRecipeCategory> recipeCategories = recipeRegistry.getRecipeCategories(focus);
if (recipeCategories.isEmpty()) {
return false;
Expand Down

0 comments on commit d32e879

Please sign in to comment.