From ed42e5383570dff08e2604b4d49a806e26405451 Mon Sep 17 00:00:00 2001 From: 90 Date: Sun, 21 Apr 2024 19:05:05 +0100 Subject: [PATCH] Don't immediately short-circuit "same ingredient" checks for shaped recipes Some mods apparently have recipes for things such as blocks from ingots and ingots from nuggets where there is not just one distinct ingredient. In those cases, they'll typically have the recipe use an extra ingredient key where the ingredient is not the tag for some ingot/nuggets, but solely the mod's own respective ingot/nugget item. As unification mods such as AlmostUnified replace this item ingredient with the tag as usual, ingredient keys aren't completely sanitised and must therefore further be checked to ensure that the "non-distinct" ingredients do actually reference the same set of items. Fixes #104. --- .../java/gripe/_90/megacells/misc/CompressionService.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/common/src/main/java/gripe/_90/megacells/misc/CompressionService.java b/common/src/main/java/gripe/_90/megacells/misc/CompressionService.java index cd31b496..42ce2583 100644 --- a/common/src/main/java/gripe/_90/megacells/misc/CompressionService.java +++ b/common/src/main/java/gripe/_90/megacells/misc/CompressionService.java @@ -158,8 +158,8 @@ private boolean isCompressionRecipe(CraftingRecipe recipe, RegistryAccess access private boolean sameIngredient(CraftingRecipe recipe) { var ingredients = recipe.getIngredients(); - if (recipe instanceof ShapedRecipe) { - return ingredients.stream().distinct().count() <= 1; + if (recipe instanceof ShapedRecipe && ingredients.stream().distinct().count() <= 1) { + return true; } // Check further for any odd cases (e.g. melon blocks having a shapeless recipe instead of a shaped one)