{
// make sure strange things didn't happen...
if ( adaptor.simulateAdd( itemStack.getItemStack() ) != null )
{
changed = true;
throw new GridAccessException();
}
IAEItemStack acquired = Platform.poweredExtraction( src, destination, itemStack, mySrc );
if ( acquired != null )
{
changed = true;
ItemStack issue = adaptor.addItems( acquired.getItemStack() );
if ( issue != null )
throw new RuntimeException( "bad attempt at managing inventory. ( addItems )" );
}
else
changed = handleCrafting( x, adaptor, itemStack ) || changed;
}
else if ( itemStack.getStackSize() < 0 )
{
IAEItemStack toStore = itemStack.copy();
toStore.setStackSize( -toStore.getStackSize() );
long diff = toStore.getStackSize();
// make sure strange things didn't happen...
ItemStack canExtract = adaptor.simulateRemove( (int) diff, toStore.getItemStack(), null );
if ( canExtract == null || canExtract.stackSize != diff )
{
changed = true;
throw new GridAccessException();
}
toStore = Platform.poweredInsert( src, destination, toStore, mySrc );
if ( toStore != null )