Skip to content

Commit

Permalink
Fix #429 Crash when a recipeCategory is missing
Browse files Browse the repository at this point in the history
  • Loading branch information
mezz committed Sep 16, 2016
1 parent fb588d9 commit f5ff94b
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions src/main/java/mezz/jei/RecipeRegistry.java
Expand Up @@ -7,6 +7,7 @@
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;

import com.google.common.collect.ArrayListMultimap;
Expand Down Expand Up @@ -73,14 +74,17 @@ public RecipeRegistry(

ImmutableMultimap.Builder<IRecipeCategory, ItemStack> craftItemsForCategoriesBuilder = ImmutableMultimap.builder();
ImmutableMultimap.Builder<String, String> categoriesForCraftItemKeysBuilder = ImmutableMultimap.builder();
for (String recipeCategoryUid : craftItemsForCategories.keySet()) {
for (Map.Entry<String, Collection<ItemStack>> recipeCategoryEntry : craftItemsForCategories.asMap().entrySet()) {
String recipeCategoryUid = recipeCategoryEntry.getKey();
IRecipeCategory recipeCategory = recipeCategoriesMap.get(recipeCategoryUid);
Collection<ItemStack> craftItems = craftItemsForCategories.get(recipeCategoryUid);
craftItemsForCategoriesBuilder.putAll(recipeCategory, craftItems);
for (ItemStack craftItem : craftItems) {
recipeInputMap.addRecipeCategory(recipeCategory, craftItem);
String craftItemKey = stackHelper.getUniqueIdentifierForStack(craftItem);
categoriesForCraftItemKeysBuilder.put(craftItemKey, recipeCategoryUid);
if (recipeCategory != null) {
Collection<ItemStack> craftItems = recipeCategoryEntry.getValue();
craftItemsForCategoriesBuilder.putAll(recipeCategory, craftItems);
for (ItemStack craftItem : craftItems) {
recipeInputMap.addRecipeCategory(recipeCategory, craftItem);
String craftItemKey = stackHelper.getUniqueIdentifierForStack(craftItem);
categoriesForCraftItemKeysBuilder.put(craftItemKey, recipeCategoryUid);
}
}
}

Expand Down

0 comments on commit f5ff94b

Please sign in to comment.