diff --git a/src/item.cpp b/src/item.cpp index e7f6fab8db13c..066308f95a1ee 100644 --- a/src/item.cpp +++ b/src/item.cpp @@ -10616,7 +10616,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;