Skip to content

Commit

Permalink
Fix the unexpected NPE
Browse files Browse the repository at this point in the history
Signed-off-by: Hendrix-Shen <[email protected]>
  • Loading branch information
Hendrix-Shen committed Dec 24, 2023
1 parent 08c8f70 commit 632e6ea
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.plusls.MasaGadget.tweakeroo.handRestockCrafting;

import com.google.common.collect.Lists;
import com.plusls.MasaGadget.ModInfo;
import com.plusls.MasaGadget.config.Configs;
import fi.dy.masa.itemscroller.recipes.CraftingHandler;
Expand All @@ -21,16 +22,18 @@
import java.util.stream.Collectors;

public class RestockUtil {
private static List<RecipePattern> recipes;
private static final List<RecipePattern> recipes = Lists.newArrayList();

public static void updateRecipes() {
RecipeStorage storage = RecipeStorage.getInstance();

try {
RestockUtil.recipes = Configs.restockWithCraftingRecipes.stream()
RestockUtil.recipes.clear();
RestockUtil.recipes.addAll(Configs.restockWithCraftingRecipes.stream()
.mapToInt(Integer::valueOf)
.mapToObj(storage::getRecipe)
.filter(recipe -> recipe.getRecipeLength() == 4)
.collect(Collectors.toList());
.collect(Collectors.toList()));
} catch (NumberFormatException exception) {
ModInfo.LOGGER.error(exception);
}
Expand Down

0 comments on commit 632e6ea

Please sign in to comment.