MCPcopy Create free account
hub / github.com/MultiMC/Launcher / applyMods

Method applyMods

launcher/minecraft/LaunchProfile.cpp:104–127  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

102}
103
104void LaunchProfile::applyMods(const QList<LibraryPtr>& mods)
105{
106 QList<LibraryPtr> * list = &m_mods;
107 for(auto & mod: mods)
108 {
109 auto modCopy = Library::limitedCopy(mod);
110
111 // find the mod by name.
112 const int index = findLibraryByName(list, mod->rawName());
113 // mod not found? just add it.
114 if (index < 0)
115 {
116 list->append(modCopy);
117 return;
118 }
119
120 auto existingLibrary = list->at(index);
121 // if we are higher it means we should update
122 if (Version(mod->version()) > Version(existingLibrary->version()))
123 {
124 list->replace(index, modCopy);
125 }
126 }
127}
128
129void LaunchProfile::applyLibrary(LibraryPtr library)
130{

Callers 1

applyToMethod · 0.80

Calls 6

findLibraryByNameFunction · 0.85
appendMethod · 0.80
VersionClass · 0.70
atMethod · 0.45
versionMethod · 0.45
replaceMethod · 0.45

Tested by

no test coverage detected