private void AddFreeRowsIfCan(MyGuiControlListbox listbox, int rowCount) { int maxRows = (int)Math.Ceiling((double)GetMaxListboxItems(listbox) / INVENTORY_COLUMNS); if (listbox.GetRowsCount() + rowCount <= maxRows) { listbox.AddRows(rowCount); } }