Skip to content

Commit

Permalink
Fix support for adding/hiding recipes at runtime
Browse files Browse the repository at this point in the history
  • Loading branch information
mezz committed Jun 14, 2018
1 parent 3618092 commit a0d9af5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
9 changes: 4 additions & 5 deletions src/main/java/mezz/jei/collect/MultiMap.java
Expand Up @@ -31,18 +31,17 @@ public boolean put(K key, V value) {
}

public boolean remove(K key, V value) {
if (map.containsKey(key)) {
return get(key).remove(value);
}
return false;
T collection = map.get(key);
return collection != null && collection.remove(value);
}

public boolean containsKey(K key) {
return map.containsKey(key);
}

public boolean contains(K key, V value) {
return get(key).contains(value);
T collection = map.get(key);
return collection != null && collection.contains(value);
}

public Set<Map.Entry<K, T>> entrySet() {
Expand Down
6 changes: 5 additions & 1 deletion src/main/java/mezz/jei/recipes/RecipeRegistry.java
Expand Up @@ -198,7 +198,11 @@ public void addRecipe(IRecipeWrapper recipe, String recipeCategoryUid) {
return;
}

addRecipe(recipe, recipe, recipeCategory);
if (hiddenRecipes.contains(recipeCategoryUid, recipe)) {
unhideRecipe(recipe, recipeCategoryUid);
} else {
addRecipe(recipe, recipe, recipeCategory);
}
}

private void addRecipe(Object recipe, String recipeCategoryUid) {
Expand Down

0 comments on commit a0d9af5

Please sign in to comment.