MCPcopy Create free account
hub / github.com/PolyMC/PolyMC / applyMods

Method applyMods

launcher/minecraft/LaunchProfile.cpp:146–169  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

144}
145
146void LaunchProfile::applyMods(const QList<LibraryPtr>& mods)
147{
148 QList<LibraryPtr> * list = &m_mods;
149 for(auto & mod: mods)
150 {
151 auto modCopy = Library::limitedCopy(mod);
152
153 // find the mod by name.
154 const int index = findLibraryByName(list, mod->rawName());
155 // mod not found? just add it.
156 if (index < 0)
157 {
158 list->append(modCopy);
159 return;
160 }
161
162 auto existingLibrary = list->at(index);
163 // if we are higher it means we should update
164 if (Version(mod->version()) > Version(existingLibrary->version()))
165 {
166 list->replace(index, modCopy);
167 }
168 }
169}
170
171void LaunchProfile::applyCompatibleJavaMajors(QList<int>& javaMajor)
172{

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