default int add(Item stack){
  int itemsLeft=stack.count();
  for (int i=0; i < size(); i++) {
    itemsLeft=add(i,stack.withAmount(itemsLeft));
  }
  if (itemsLeft != stack.count()) {
    markChanged();
  }
  return itemsLeft;
}

default int add ( Item stack ) { int itemsLeft = stack . count ( ) ; for ( int i = 0 ; i < size ( ) ; i ++ ) { itemsLeft = add ( i , stack . withAmount ( itemsLeft ) ) ; } if ( itemsLeft != stack . count ( ) ) { markChanged ( ) ; } return itemsLeft ; }
adds items to this inventory
