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

Method load

launcher/minecraft/PackProfile.cpp:305–342  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

303}
304
305bool PackProfile::load()
306{
307 auto filename = componentsFilePath();
308
309 // load the new component list and swap it with the current one...
310 ComponentContainer newComponents;
311 if(!loadPackProfile(this, filename, patchesPattern(), newComponents))
312 {
313 qCritical() << "Failed to load the component config for instance" << d->m_instance->name();
314 return false;
315 }
316 else
317 {
318 // FIXME: actually use fine-grained updates, not this...
319 beginResetModel();
320 // disconnect all the old components
321 for(auto component: d->components)
322 {
323 disconnect(component.get(), &Component::dataChanged, this, &PackProfile::componentDataChanged);
324 }
325 d->components.clear();
326 d->componentIndex.clear();
327 for(auto component: newComponents)
328 {
329 if(d->componentIndex.contains(component->m_uid))
330 {
331 qWarning() << "Ignoring duplicate component entry" << component->m_uid;
332 continue;
333 }
334 connect(component.get(), &Component::dataChanged, this, &PackProfile::componentDataChanged);
335 d->components.append(component);
336 d->componentIndex[component->m_uid] = component;
337 }
338 endResetModel();
339 d->loaded = true;
340 return true;
341 }
342}
343
344void PackProfile::reload(Net::Mode netmode)
345{

Callers 4

loadComponentFunction · 0.45
loadIndexFunction · 0.45
getVersionFileMethod · 0.45
isVersionChangeableMethod · 0.45

Calls 6

loadPackProfileFunction · 0.85
appendMethod · 0.80
nameMethod · 0.45
getMethod · 0.45
clearMethod · 0.45
containsMethod · 0.45

Tested by

no test coverage detected