diff --git a/src/item.cpp b/src/item.cpp index bf22b5d660e0..2cc0dbfde8c0 100644 --- a/src/item.cpp +++ b/src/item.cpp @@ -9503,7 +9503,15 @@ std::vector item::get_uncraft_components() const } else { //Make a new vector of components from the registered components for( const item &component : components ) { - ret.push_back( item_comp( component.typeId(), component.count() ) ); + auto iter = std::find_if( ret.begin(), ret.end(), [component]( item_comp & obj ) { + return obj.type == component.typeId(); + } ); + + if( iter != ret.end() ) { + iter->count += component.count(); + } else { + ret.push_back( item_comp( component.typeId(), component.count() ) ); + } } } return ret;