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

Method setVersion

launcher/minecraft/Component.cpp:287–326  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

285}
286
287void Component::setVersion(const QString& version)
288{
289 if(version == m_version)
290 {
291 return;
292 }
293 m_version = version;
294 if(m_loaded)
295 {
296 // we are loaded and potentially have state to invalidate
297 if(m_file)
298 {
299 // we have a file... explicit version has been changed and there is nothing else to do.
300 }
301 else
302 {
303 // we don't have a file, therefore we are loaded with metadata
304 m_cachedVersion = version;
305 // see if the meta version is loaded
306 auto metaVersion = APPLICATION->metadataIndex()->get(m_uid, version);
307 if(metaVersion->isLoaded())
308 {
309 // if yes, we can continue with that.
310 m_metaVersion = metaVersion;
311 }
312 else
313 {
314 // if not, we need loading
315 m_metaVersion.reset();
316 m_loaded = false;
317 }
318 updateCachedData();
319 }
320 }
321 else
322 {
323 // not loaded... assume it will be sorted out later by the update task
324 }
325 emit dataChanged();
326}
327
328bool Component::customize()
329{

Callers 2

resolveDependenciesMethod · 0.80
setComponentVersionMethod · 0.80

Calls 4

metadataIndexMethod · 0.80
getMethod · 0.45
isLoadedMethod · 0.45
resetMethod · 0.45

Tested by

no test coverage detected