diff --git a/crafting/CraftingJob.java b/crafting/CraftingJob.java index 5f8a38d19..f317f382a 100644 --- a/crafting/CraftingJob.java +++ b/crafting/CraftingJob.java @@ -100,11 +100,26 @@ public class CraftingJob implements ICraftingParent } } - private void extractItems(IAEItemStack[] requirements, IMEInventory inv, IItemList storage2, IItemList missing) + private void extractItems(IAEItemStack[] requirements, IMEInventory inv, IItemList dest, IItemList missing) { for (IAEItemStack is : requirements) { - inv.extractItems( is, Actionable.MODULATE, jobHost.getActionSrc() ); + IAEItemStack avail = inv.extractItems( is, Actionable.MODULATE, jobHost.getActionSrc() ); + + if ( avail == null ) + { + missing.add( is ); + continue; + } + + if ( avail.getStackSize() != is.getStackSize() ) + { + IAEItemStack ais = avail.copy(); + ais.setStackSize( is.getStackSize() - avail.getStackSize() ); + missing.add( ais ); + } + + dest.add( avail ); } } @@ -114,6 +129,12 @@ public class CraftingJob implements ICraftingParent for (IAEItemStack is : requirements) { IAEItemStack avail = inv.extractItems( is, Actionable.SIMULATE, jobHost.getActionSrc() ); + + if ( avail == null ) + return false; + + if ( avail.getStackSize() != is.getStackSize() ) + return false; } return true;