Skip to content

Commit 9eae868

Browse files
Copilotrubensworks
andauthored
Fix crash on invalid Stone Cutter recipes, Closes #178
* Initial plan * Fix crash on incorrect recipe by catching IllegalArgumentException (fix by @Niikelion) Co-authored-by: rubensworks <440384+rubensworks@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: rubensworks <440384+rubensworks@users.noreply.github.com>
1 parent 58a6ad3 commit 9eae868

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

src/main/java/org/cyclops/integratedcrafting/core/CraftingJobHandler.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -562,7 +562,11 @@ protected boolean insertCrafting(PartPos target, IMixedIngredients ingredients,
562562
// First check our crafting overrides
563563
for (ICraftingProcessOverride craftingProcessOverride : this.craftingProcessOverrides) {
564564
if (craftingProcessOverride.isApplicable(target)) {
565-
return craftingProcessOverride.craft(targetGetter, ingredients, recipe, this.resultsSink, craftingJob, simulate);
565+
try {
566+
return craftingProcessOverride.craft(targetGetter, ingredients, recipe, this.resultsSink, craftingJob, simulate);
567+
} catch (IllegalArgumentException e) {
568+
return false;
569+
}
566570
}
567571
}
568572

@@ -576,7 +580,7 @@ protected void insertLoopNonBlocking(INetwork network, int channel, PartPos targ
576580
IRecipeDefinition recipe = craftingJob.getRecipe();
577581
IMixedIngredients ingredientsSimulated = CraftingHelpers.getRecipeInputsFromCraftingJobBuffer(craftingJob,
578582
recipe, true, 1);
579-
if (ingredientsSimulated == null ||!insertCrafting(targetPos, ingredientsSimulated, recipe, craftingJob, network, channel, true)) {
583+
if (ingredientsSimulated == null || !insertCrafting(targetPos, ingredientsSimulated, recipe, craftingJob, network, channel, true)) {
580584
break;
581585
}
582586
if (!consumeAndInsertCrafting(true, network, channel, targetPos, craftingJob)) {

0 commit comments

Comments
 (0)