Skip to content

Commit 3c7641c

Browse files
committed
Work around broken mods that *throw exceptions* in getCraftingRemainingItem bringing down RecipeCrawlHandler as collateral damage
1 parent 4c60bb1 commit 3c7641c

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

changelog.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
- Work around broken mods that *throw exceptions* in getCraftingRemainingItem bringing down RecipeCrawlHandler as collateral damage

src/main/java/org/violetmoon/zeta/util/handler/RecipeCrawlHandler.java

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,11 +156,18 @@ private static void digest(Recipe<?> recipe, RegistryAccess access) {
156156
for (Ingredient ingredient : ingredients) {
157157
for (ItemStack inStack : ingredient.getItems()) {
158158
//don't include catalyst items. This includes partial ones like buckets and such
159-
ItemStack remaining = inStack.getCraftingRemainingItem();
159+
ItemStack remaining;
160+
161+
try {
162+
remaining = inStack.getCraftingRemainingItem();
163+
} catch(Exception e) {
164+
ZetaMod.LOGGER.error("Item {} threw an exception from IForgeItemStack#getCraftingRemainingItem!! This is very broken, report to the author of that mod", inStack.getItem(), e);
165+
continue;
166+
}
160167

161168
if(remaining == null) {
162169
//sigh. let's at least not make this into our problem
163-
ZetaMod.LOGGER.error("Item {} returned NULL from getCraftingRemainingItem. This is wrong and will cause problems down the line", inStack.getItem());
170+
ZetaMod.LOGGER.error("Item {} returned NULL from IForgeItemStack#getCraftingRemainingItem. This is wrong and will cause problems down the line", inStack.getItem());
164171
continue;
165172
}
166173

0 commit comments

Comments
 (0)