From 333935bd85ac11bb149a04573790e3561c7bb039 Mon Sep 17 00:00:00 2001 From: raoulvdberge Date: Thu, 8 Mar 2018 21:38:47 +0100 Subject: [PATCH] Fixed an autocrafting crash, fixes #1567 --- CHANGELOG.md | 1 + .../apiimpl/autocrafting/task/CraftingTask.java | 16 ++++++++++------ 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1b0001f01..1da8bb612 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ - Fixed orientations of the Portable Grid (TeamSpen210) - Fixed crafting event in Crafting Grid being fired twice (raoulvdberge) - Fixed a crash when the Constructor tries to place a block when a multipart is attached to it (raoulvdberge) +- Fixed an autocrafting crash (raoulvdberge) - Attempted to fix FPS drop on Grid sorting (raoulvdberge) - Disk Manipulator in fluid mode will now extract a bucket at a time instead of 1 mB (or 64 buckets at a time with a Stack Upgrade instead of 64 mB) (raoulvdberge) diff --git a/src/main/java/com/raoulvdberge/refinedstorage/apiimpl/autocrafting/task/CraftingTask.java b/src/main/java/com/raoulvdberge/refinedstorage/apiimpl/autocrafting/task/CraftingTask.java index 41921653f..506c67033 100755 --- a/src/main/java/com/raoulvdberge/refinedstorage/apiimpl/autocrafting/task/CraftingTask.java +++ b/src/main/java/com/raoulvdberge/refinedstorage/apiimpl/autocrafting/task/CraftingTask.java @@ -249,15 +249,19 @@ public class CraftingTask implements ICraftingTask { toCraft.add(inputCrafted); actualInputs.add(inputCrafted); - previousSteps.add(calculate(networkItems, networkFluids, inputPattern, toInsert)); + ICraftingStep step = calculate(networkItems, networkFluids, inputPattern, toInsert); input.shrink(craftQuantity); - if (recursedPattern == null) { - // Calculate added all the crafted outputs toInsert - // So we remove the ones we use from toInsert - ItemStack inserted = toInsert.get(inputCrafted, compare); - toInsert.remove(inserted, craftQuantity); + if (step != null) { + previousSteps.add(step); + + if (recursedPattern == null) { + // Calculate added all the crafted outputs toInsert + // So we remove the ones we use from toInsert + ItemStack inserted = toInsert.get(inputCrafted, compare); + toInsert.remove(inserted, craftQuantity); + } } } else { // Fluid checks are with a stack size of one