diff --git a/src/main/java/com/raoulvdberge/refinedstorage/api/autocrafting/task/ICraftingStep.java b/src/main/java/com/raoulvdberge/refinedstorage/api/autocrafting/task/ICraftingStep.java index 56e793375..58464f037 100755 --- a/src/main/java/com/raoulvdberge/refinedstorage/api/autocrafting/task/ICraftingStep.java +++ b/src/main/java/com/raoulvdberge/refinedstorage/api/autocrafting/task/ICraftingStep.java @@ -72,8 +72,11 @@ public interface ICraftingStep { boolean hasReceivedOutput(ItemStack stack); /** + * The {@link ItemStack} given to it will be changed and contain the remainder + * The return value will only be true if the stack size is zero + * * @param stack the stack that was inserted in the storage system - * @return true if this item belonged to the processable item, false otherwise + * @return true if this item belonged to the processable item and was fully used, false otherwise */ boolean onReceiveOutput(ItemStack stack); diff --git a/src/main/java/com/raoulvdberge/refinedstorage/apiimpl/autocrafting/task/CraftingStep.java b/src/main/java/com/raoulvdberge/refinedstorage/apiimpl/autocrafting/task/CraftingStep.java index bb24b0fb5..d2aafe7e6 100755 --- a/src/main/java/com/raoulvdberge/refinedstorage/apiimpl/autocrafting/task/CraftingStep.java +++ b/src/main/java/com/raoulvdberge/refinedstorage/apiimpl/autocrafting/task/CraftingStep.java @@ -123,11 +123,15 @@ public abstract class CraftingStep implements ICraftingStep { } if (API.instance().getComparer().isEqual(stack, output, CraftingTask.DEFAULT_COMPARE | (getPattern().isOredict() ? IComparer.COMPARE_OREDICT : 0))) { if (received < output.stackSize) { - satisfied.put(hashcode, received + stack.stackSize); + int toReceive = Math.min(output.stackSize - received, stack.stackSize); + satisfied.put(hashcode, received + toReceive); + stack.stackSize -= toReceive; network.sendCraftingMonitorUpdate(); - return true; + if (stack.stackSize == 0) { + return true; + } } } } diff --git a/src/main/java/com/raoulvdberge/refinedstorage/tile/TileController.java b/src/main/java/com/raoulvdberge/refinedstorage/tile/TileController.java index d07f38f24..e4a8640c3 100755 --- a/src/main/java/com/raoulvdberge/refinedstorage/tile/TileController.java +++ b/src/main/java/com/raoulvdberge/refinedstorage/tile/TileController.java @@ -553,10 +553,11 @@ public class TileController extends TileBase implements INetworkMaster, IEnergyR if (!simulate && inserted > 0 && accessType != AccessType.WRITE) { itemStorage.add(ItemHandlerHelper.copyStackWithSize(stack, inserted), false); + ItemStack checkSteps = ItemHandlerHelper.copyStackWithSize(stack, inserted); for (ICraftingTask task : craftingTasks) { for (ICraftingStep processable : task.getSteps()) { - if (processable.onReceiveOutput(stack)) { + if (processable.onReceiveOutput(checkSteps)) { return remainder; // All done } }