fixed unknown recipe types. Fixes #1068

This commit is contained in:
gnembon committed 2021-08-19 09:43:00 -03:00
1 parent 03353a7675
commit 6222c97375
3 files changed
+5 -3

No files matched your search

@@ -22,9 +22,11 @@ public class RecipeManager_scarpetMixin implements RecipeManagerInterface
@Shadow private Map<RecipeType<?>, Map<Identifier, Recipe<?>>> recipes;
@Override
public List<Recipe<?>> getAllMatching(RecipeType type, Identifier output)
public List<Recipe<?>> getAllMatching(RecipeType<?> type, Identifier output)
{
Map<Identifier, Recipe<?>> typeRecipes = recipes.get(type);
// happens when mods add recipe to the registry without updating recipe manager
if (typeRecipes == null) return Collections.emptyList();
if (typeRecipes.containsKey(output)) return Collections.singletonList(typeRecipes.get(output));
return Lists.newArrayList(typeRecipes.values().stream().filter(
r -> Registry.ITEM.getId(r.getOutput().getItem()).equals(output)).collect(Collectors.toList()));