fuzz = fuzz.copy();
fuzz.setStackSize( input[x].getStackSize() );
if ( details.isValidItemForSlot( x, fuzz.getItemStack(), getWorld() ) )
{
IAEItemStack ais = inventory.extractItems( fuzz, Actionable.MODULATE, machineSrc );
ItemStack is = ais == null ? null : ais.getItemStack();
if ( is != null )
{
postChange( AEItemStack.create( is ), machineSrc );
ic.setInventorySlotContents( x, is );
found = true;
break;
}
}
}
}
else
{
IAEItemStack ais = inventory.extractItems( input[x].copy(), Actionable.MODULATE, machineSrc );
ItemStack is = ais == null ? null : ais.getItemStack();
if ( is != null )
{
postChange( input[x], machineSrc );
ic.setInventorySlotContents( x, is );
if ( is.stackSize == input[x].getStackSize() )
{
found = true;
continue;
}
}
}
if ( !found )
break;
}
}
if ( !found )
{
// put stuff back..
for (int x = 0; x < ic.getSizeInventory(); x++)
{
ItemStack is = ic.getStackInSlot( x );
if ( is != null )
inventory.injectItems( AEItemStack.create( is ), Actionable.MODULATE, machineSrc );
}
ic = null;
break;
}
}
if ( m.pushPattern( details, ic ) )
{
somethingChanged = true;
remainingOperations--;
for (IAEItemStack out : details.getCondensedOutputs())
{
postChange( out, machineSrc );
waitingFor.add( out.copy() );
postCraftingStatusChange( out.copy() );
}
if ( details.isCraftable() )
{
FMLCommonHandler.instance().firePlayerCraftingEvent( Platform.getPlayer( (WorldServer) getWorld() ),
details.getOutput( ic, getWorld() ), ic );
for (int x = 0; x < ic.getSizeInventory(); x++)
{
ItemStack output = Platform.getContainerItem( ic.getStackInSlot( x ) );
if ( output != null )
{
IAEItemStack cItem = AEItemStack.create( output );
postChange( cItem, machineSrc );
waitingFor.add( cItem );
postCraftingStatusChange( cItem );
}
}