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

Method executeTask

launcher/minecraft/launch/ModMinecraftJar.cpp:24–62  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

22#include "minecraft/PackProfile.h"
23
24void ModMinecraftJar::executeTask()
25{
26 auto m_inst = std::dynamic_pointer_cast<MinecraftInstance>(m_parent->instance());
27
28 if(!m_inst->getJarMods().size())
29 {
30 emitSucceeded();
31 return;
32 }
33 // nuke obsolete stripped jar(s) if needed
34 if(!FS::ensureFolderPathExists(m_inst->binRoot()))
35 {
36 emitFailed(tr("Couldn't create the bin folder for Minecraft.jar"));
37 }
38
39 auto finalJarPath = QDir(m_inst->binRoot()).absoluteFilePath("minecraft.jar");
40 if(!removeJar())
41 {
42 emitFailed(tr("Couldn't remove stale jar file: %1").arg(finalJarPath));
43 }
44
45 // create temporary modded jar, if needed
46 auto components = m_inst->getPackProfile();
47 auto profile = components->getProfile();
48 auto jarMods = m_inst->getJarMods();
49 if(jarMods.size())
50 {
51 auto mainJar = profile->getMainJar();
52 QStringList jars, temp1, temp2, temp3, temp4;
53 mainJar->getApplicableFiles(currentSystem, jars, temp1, temp2, temp3, m_inst->getLocalLibraryPath());
54 auto sourceJarPath = jars[0];
55 if(!MMCZip::createModdedJar(sourceJarPath, finalJarPath, jarMods))
56 {
57 emitFailed(tr("Failed to create the custom Minecraft jar file."));
58 return;
59 }
60 }
61 emitSucceeded();
62}
63
64void ModMinecraftJar::finalize()
65{

Callers

nothing calls this directly

Calls 11

ensureFolderPathExistsFunction · 0.85
getJarModsMethod · 0.80
getPackProfileMethod · 0.80
getProfileMethod · 0.80
getMainJarMethod · 0.80
getApplicableFilesMethod · 0.80
getLocalLibraryPathMethod · 0.80
QDirClass · 0.50
instanceMethod · 0.45
sizeMethod · 0.45
binRootMethod · 0.45

Tested by

no test coverage detected