summaryrefslogtreecommitdiffstats
path: root/logic/minecraft
diff options
context:
space:
mode:
authorPetr Mrázek <peterix@gmail.com>2016-03-13 20:57:01 +0100
committerPetr Mrázek <peterix@gmail.com>2016-03-26 17:05:27 +0100
commitfb9dfcb951d9cf9c19fc868703cb66e15aa9a1e6 (patch)
treeffff93a5ac0de669293d695c446ae2051c74cb4f /logic/minecraft
parent010e07eb4552d805ad3dc08347531d9bad6b3c24 (diff)
downloadMultiMC-fb9dfcb951d9cf9c19fc868703cb66e15aa9a1e6.tar
MultiMC-fb9dfcb951d9cf9c19fc868703cb66e15aa9a1e6.tar.gz
MultiMC-fb9dfcb951d9cf9c19fc868703cb66e15aa9a1e6.tar.lz
MultiMC-fb9dfcb951d9cf9c19fc868703cb66e15aa9a1e6.tar.xz
MultiMC-fb9dfcb951d9cf9c19fc868703cb66e15aa9a1e6.zip
NOISSUE stop referring to the minecraft profile as 'version'
Diffstat (limited to 'logic/minecraft')
-rw-r--r--logic/minecraft/MinecraftVersion.cpp20
-rw-r--r--logic/minecraft/MinecraftVersion.h4
-rw-r--r--logic/minecraft/ProfilePatch.h2
-rw-r--r--logic/minecraft/VersionFile.cpp24
-rw-r--r--logic/minecraft/VersionFile.h2
-rw-r--r--logic/minecraft/ftb/OneSixFTBInstance.cpp2
-rw-r--r--logic/minecraft/onesix/OneSixInstance.cpp46
-rw-r--r--logic/minecraft/onesix/OneSixInstance.h2
-rw-r--r--logic/minecraft/onesix/OneSixUpdate.cpp24
9 files changed, 64 insertions, 62 deletions
diff --git a/logic/minecraft/MinecraftVersion.cpp b/logic/minecraft/MinecraftVersion.cpp
index 6b9420b7..a2897950 100644
--- a/logic/minecraft/MinecraftVersion.cpp
+++ b/logic/minecraft/MinecraftVersion.cpp
@@ -58,11 +58,11 @@ bool MinecraftVersion::isMinecraftVersion()
return true;
}
-void MinecraftVersion::applyFileTo(MinecraftProfile *version)
+void MinecraftVersion::applyFileTo(MinecraftProfile *profile)
{
if(m_versionSource == Local && getVersionFile())
{
- getVersionFile()->applyTo(version);
+ getVersionFile()->applyTo(profile);
}
else
{
@@ -149,12 +149,12 @@ ProblemSeverity MinecraftVersion::getProblemSeverity()
return ProfilePatch::getProblemSeverity();
}
-void MinecraftVersion::applyTo(MinecraftProfile *version)
+void MinecraftVersion::applyTo(MinecraftProfile *profile)
{
// do we have this one cached?
if (m_versionSource == Local)
{
- applyFileTo(version);
+ applyFileTo(profile);
return;
}
// if not builtin, do not proceed any further.
@@ -163,12 +163,12 @@ void MinecraftVersion::applyTo(MinecraftProfile *version)
throw VersionIncomplete(QObject::tr(
"Minecraft version %1 could not be applied: version files are missing.").arg(m_descriptor));
}
- version->applyMinecraftVersion(m_descriptor);
- version->applyMainClass(m_mainClass);
- version->applyAppletClass(m_appletClass);
- version->applyMinecraftArguments(" ${auth_player_name} ${auth_session}"); // all builtin versions are legacy
- version->applyMinecraftVersionType(m_type);
- version->applyTraits(m_traits);
+ profile->applyMinecraftVersion(m_descriptor);
+ profile->applyMainClass(m_mainClass);
+ profile->applyAppletClass(m_appletClass);
+ profile->applyMinecraftArguments(" ${auth_player_name} ${auth_session}"); // all builtin versions are legacy
+ profile->applyMinecraftVersionType(m_type);
+ profile->applyTraits(m_traits);
}
int MinecraftVersion::getOrder()
diff --git a/logic/minecraft/MinecraftVersion.h b/logic/minecraft/MinecraftVersion.h
index aca9c08d..2c1eb289 100644
--- a/logic/minecraft/MinecraftVersion.h
+++ b/logic/minecraft/MinecraftVersion.h
@@ -40,7 +40,7 @@ public: /* methods */
virtual QString typeString() const override;
virtual bool hasJarMods() override;
virtual bool isMinecraftVersion() override;
- virtual void applyTo(MinecraftProfile *version) override;
+ virtual void applyTo(MinecraftProfile *profile) override;
virtual int getOrder() override;
virtual void setOrder(int order) override;
virtual QList<JarmodPtr> getJarMods() override;
@@ -86,7 +86,7 @@ public: /* methods */
virtual ProblemSeverity getProblemSeverity() override;
private: /* methods */
- void applyFileTo(MinecraftProfile *version);
+ void applyFileTo(MinecraftProfile *profile);
protected: /* data */
VersionSource m_versionSource = Builtin;
diff --git a/logic/minecraft/ProfilePatch.h b/logic/minecraft/ProfilePatch.h
index 0d01ba87..56bc58a7 100644
--- a/logic/minecraft/ProfilePatch.h
+++ b/logic/minecraft/ProfilePatch.h
@@ -47,7 +47,7 @@ class ProfilePatch
{
public:
virtual ~ProfilePatch(){};
- virtual void applyTo(MinecraftProfile *version) = 0;
+ virtual void applyTo(MinecraftProfile *profile) = 0;
virtual bool isMinecraftVersion() = 0;
virtual bool hasJarMods() = 0;
diff --git a/logic/minecraft/VersionFile.cpp b/logic/minecraft/VersionFile.cpp
index 8476632e..de6eff4c 100644
--- a/logic/minecraft/VersionFile.cpp
+++ b/logic/minecraft/VersionFile.cpp
@@ -22,9 +22,9 @@ bool VersionFile::hasJarMods()
return !jarMods.isEmpty();
}
-void VersionFile::applyTo(MinecraftProfile *version)
+void VersionFile::applyTo(MinecraftProfile *profile)
{
- auto theirVersion = version->getMinecraftVersion();
+ auto theirVersion = profile->getMinecraftVersion();
if (!theirVersion.isNull() && !mcVersion.isNull())
{
if (QRegExp(mcVersion, Qt::CaseInsensitive, QRegExp::Wildcard).indexIn(theirVersion) == -1)
@@ -32,22 +32,22 @@ void VersionFile::applyTo(MinecraftProfile *version)
throw MinecraftVersionMismatch(fileId, mcVersion, theirVersion);
}
}
- version->applyMinecraftVersion(id);
- version->applyMainClass(mainClass);
- version->applyAppletClass(appletClass);
- version->applyMinecraftArguments(minecraftArguments);
+ profile->applyMinecraftVersion(id);
+ profile->applyMainClass(mainClass);
+ profile->applyAppletClass(appletClass);
+ profile->applyMinecraftArguments(minecraftArguments);
if (isMinecraftVersion())
{
- version->applyMinecraftVersionType(type);
+ profile->applyMinecraftVersionType(type);
}
- version->applyMinecraftAssets(assets);
- version->applyTweakers(addTweakers);
+ profile->applyMinecraftAssets(assets);
+ profile->applyTweakers(addTweakers);
- version->applyJarMods(jarMods);
- version->applyTraits(traits);
+ profile->applyJarMods(jarMods);
+ profile->applyTraits(traits);
for (auto library : libraries)
{
- version->applyLibrary(library);
+ profile->applyLibrary(library);
}
}
diff --git a/logic/minecraft/VersionFile.h b/logic/minecraft/VersionFile.h
index 47ebf9eb..49c55646 100644
--- a/logic/minecraft/VersionFile.h
+++ b/logic/minecraft/VersionFile.h
@@ -23,7 +23,7 @@ class VersionFile : public ProfilePatch
friend class MojangVersionFormat;
friend class OneSixVersionFormat;
public: /* methods */
- virtual void applyTo(MinecraftProfile *version) override;
+ virtual void applyTo(MinecraftProfile *profile) override;
virtual bool isMinecraftVersion() override;
virtual bool hasJarMods() override;
virtual int getOrder() override
diff --git a/logic/minecraft/ftb/OneSixFTBInstance.cpp b/logic/minecraft/ftb/OneSixFTBInstance.cpp
index 19ec870a..81e939a1 100644
--- a/logic/minecraft/ftb/OneSixFTBInstance.cpp
+++ b/logic/minecraft/ftb/OneSixFTBInstance.cpp
@@ -122,7 +122,7 @@ bool OneSixFTBInstance::providesVersionFile() const
void OneSixFTBInstance::createProfile()
{
- m_version.reset(new MinecraftProfile(new FTBProfileStrategy(this)));
+ m_profile.reset(new MinecraftProfile(new FTBProfileStrategy(this)));
}
std::shared_ptr<Task> OneSixFTBInstance::createUpdateTask()
diff --git a/logic/minecraft/onesix/OneSixInstance.cpp b/logic/minecraft/onesix/OneSixInstance.cpp
index c64d527f..3e83ff1c 100644
--- a/logic/minecraft/onesix/OneSixInstance.cpp
+++ b/logic/minecraft/onesix/OneSixInstance.cpp
@@ -50,7 +50,7 @@ void OneSixInstance::init()
void OneSixInstance::createProfile()
{
- m_version.reset(new MinecraftProfile(new OneSixProfileStrategy(this)));
+ m_profile.reset(new MinecraftProfile(new OneSixProfileStrategy(this)));
}
QSet<QString> OneSixInstance::traits()
@@ -61,7 +61,9 @@ QSet<QString> OneSixInstance::traits()
return {"version-incomplete"};
}
else
+ {
return version->getTraits();
+ }
}
std::shared_ptr<Task> OneSixInstance::createUpdateTask()
@@ -95,8 +97,8 @@ QString replaceTokensIn(QString text, QMap<QString, QString> with)
QStringList OneSixInstance::processMinecraftArgs(AuthSessionPtr session)
{
- QString args_pattern = m_version->getMinecraftArguments();
- for (auto tweaker : m_version->getTweakers())
+ QString args_pattern = m_profile->getMinecraftArguments();
+ for (auto tweaker : m_profile->getTweakers())
{
args_pattern += " --tweakClass " + tweaker;
}
@@ -111,9 +113,9 @@ QStringList OneSixInstance::processMinecraftArgs(AuthSessionPtr session)
// blatant self-promotion.
token_mapping["profile_name"] = token_mapping["version_name"] = "MultiMC5";
- if(m_version->isVanilla())
+ if(m_profile->isVanilla())
{
- token_mapping["version_type"] = m_version->getMinecraftVersionType();
+ token_mapping["version_type"] = m_profile->getMinecraftVersionType();
}
else
{
@@ -123,14 +125,14 @@ QStringList OneSixInstance::processMinecraftArgs(AuthSessionPtr session)
QString absRootDir = QDir(minecraftRoot()).absolutePath();
token_mapping["game_directory"] = absRootDir;
QString absAssetsDir = QDir("assets/").absolutePath();
- token_mapping["game_assets"] = AssetsUtils::reconstructAssets(m_version->getMinecraftAssets()).absolutePath();
+ token_mapping["game_assets"] = AssetsUtils::reconstructAssets(m_profile->getMinecraftAssets()).absolutePath();
token_mapping["user_properties"] = session->serializeUserProperties();
token_mapping["user_type"] = session->user_type;
// 1.7.3+ assets tokens
token_mapping["assets_root"] = absAssetsDir;
- token_mapping["assets_index_name"] = m_version->getMinecraftAssets();
+ token_mapping["assets_index_name"] = m_profile->getMinecraftAssets();
QStringList parts = args_pattern.split(' ', QString::SkipEmptyParts);
for (int i = 0; i < parts.length(); i++)
@@ -147,7 +149,7 @@ QString OneSixInstance::createLaunchScript(AuthSessionPtr session)
auto pixmap = icon.pixmap(128, 128);
pixmap.save(FS::PathCombine(minecraftRoot(), "icon.png"), "PNG");
- if (!m_version)
+ if (!m_profile)
return nullptr;
for(auto & mod: loaderModList()->allMods())
@@ -172,14 +174,14 @@ QString OneSixInstance::createLaunchScript(AuthSessionPtr session)
launchScript += "coremod " + coremod.filename().completeBaseName() + "\n";;
}
- for(auto & jarmod: m_version->getJarMods())
+ for(auto & jarmod: m_profile->getJarMods())
{
launchScript += "jarmod " + jarmod->originalName + " (" + jarmod->name + ")\n";
}
// libraries and class path.
{
- auto libs = m_version->getLibraries();
+ auto libs = m_profile->getLibraries();
for (auto lib : libs)
{
launchScript += "cp " + QFileInfo(lib->storagePath()).absoluteFilePath() + "\n";
@@ -191,16 +193,16 @@ QString OneSixInstance::createLaunchScript(AuthSessionPtr session)
}
else
{
- QString relpath = m_version->getMinecraftVersion() + "/" + m_version->getMinecraftVersion() + ".jar";
+ QString relpath = m_profile->getMinecraftVersion() + "/" + m_profile->getMinecraftVersion() + ".jar";
launchScript += "cp " + versionsPath().absoluteFilePath(relpath) + "\n";
}
}
- auto mainClass = m_version->getMainClass();
+ auto mainClass = m_profile->getMainClass();
if (!mainClass.isEmpty())
{
launchScript += "mainClass " + mainClass + "\n";
}
- auto appletClass = m_version->getAppletClass();
+ auto appletClass = m_profile->getAppletClass();
if (!appletClass.isEmpty())
{
launchScript += "appletClass " + appletClass + "\n";
@@ -234,7 +236,7 @@ QString OneSixInstance::createLaunchScript(AuthSessionPtr session)
// native libraries (mostly LWJGL)
{
QDir natives_dir(FS::PathCombine(instanceRoot(), "natives/"));
- for (auto native : m_version->getNativeLibraries())
+ for (auto native : m_profile->getNativeLibraries())
{
QFileInfo finfo(native->storagePath());
launchScript += "ext " + finfo.absoluteFilePath() + "\n";
@@ -243,7 +245,7 @@ QString OneSixInstance::createLaunchScript(AuthSessionPtr session)
}
// traits. including legacyLaunch and others ;)
- for (auto trait : m_version->getTraits())
+ for (auto trait : m_profile->getTraits())
{
launchScript += "traits " + trait + "\n";
}
@@ -313,9 +315,9 @@ std::shared_ptr<Task> OneSixInstance::createJarModdingTask()
}
virtual void executeTask()
{
- std::shared_ptr<MinecraftProfile> version = m_inst->getMinecraftProfile();
+ auto profile = m_inst->getMinecraftProfile();
// nuke obsolete stripped jar(s) if needed
- QString version_id = version->getMinecraftVersion();
+ QString version_id = profile->getMinecraftVersion();
QString strippedPath = version_id + "/" + version_id + "-stripped.jar";
QFile strippedJar(strippedPath);
if(strippedJar.exists())
@@ -431,7 +433,7 @@ bool OneSixInstance::setIntendedVersionId(QString version)
QList< Mod > OneSixInstance::getJarMods() const
{
QList<Mod> mods;
- for (auto jarmod : m_version->getJarMods())
+ for (auto jarmod : m_profile->getJarMods())
{
QString filePath = jarmodsPath().absoluteFilePath(jarmod->name);
mods.push_back(Mod(QFileInfo(filePath)));
@@ -463,7 +465,7 @@ void OneSixInstance::reloadProfile()
{
try
{
- m_version->reload();
+ m_profile->reload();
unsetFlag(VersionBrokenFlag);
emit versionReloaded();
}
@@ -472,7 +474,7 @@ void OneSixInstance::reloadProfile()
}
catch (Exception &error)
{
- m_version->clear();
+ m_profile->clear();
setFlag(VersionBrokenFlag);
// TODO: rethrow to show some error message(s)?
emit versionReloaded();
@@ -482,13 +484,13 @@ void OneSixInstance::reloadProfile()
void OneSixInstance::clearProfile()
{
- m_version->clear();
+ m_profile->clear();
emit versionReloaded();
}
std::shared_ptr<MinecraftProfile> OneSixInstance::getMinecraftProfile() const
{
- return m_version;
+ return m_profile;
}
QDir OneSixInstance::librariesPath() const
diff --git a/logic/minecraft/onesix/OneSixInstance.h b/logic/minecraft/onesix/OneSixInstance.h
index 09150158..0a92ab2f 100644
--- a/logic/minecraft/onesix/OneSixInstance.h
+++ b/logic/minecraft/onesix/OneSixInstance.h
@@ -101,7 +101,7 @@ private:
QStringList processMinecraftArgs(AuthSessionPtr account);
protected:
- std::shared_ptr<MinecraftProfile> m_version;
+ std::shared_ptr<MinecraftProfile> m_profile;
mutable std::shared_ptr<ModList> m_loader_mod_list;
mutable std::shared_ptr<ModList> m_core_mod_list;
mutable std::shared_ptr<ModList> m_resource_pack_list;
diff --git a/logic/minecraft/onesix/OneSixUpdate.cpp b/logic/minecraft/onesix/OneSixUpdate.cpp
index 78938a4f..814cde18 100644
--- a/logic/minecraft/onesix/OneSixUpdate.cpp
+++ b/logic/minecraft/onesix/OneSixUpdate.cpp
@@ -87,8 +87,8 @@ void OneSixUpdate::assetIndexStart()
{
setStatus(tr("Updating assets index..."));
OneSixInstance *inst = (OneSixInstance *)m_inst;
- std::shared_ptr<MinecraftProfile> version = inst->getMinecraftProfile();
- QString assetName = version->getMinecraftAssets();
+ auto profile = inst->getMinecraftProfile();
+ QString assetName = profile->getMinecraftAssets();
QUrl indexUrl = "http://" + URLConstants::AWS_DOWNLOAD_INDEXES + assetName + ".json";
QString localPath = assetName + ".json";
auto job = new NetJob(tr("Asset index for %1").arg(inst->name()));
@@ -113,8 +113,8 @@ void OneSixUpdate::assetIndexFinished()
qDebug() << m_inst->name() << ": Finished asset index download";
OneSixInstance *inst = (OneSixInstance *)m_inst;
- std::shared_ptr<MinecraftProfile> version = inst->getMinecraftProfile();
- QString assetName = version->getMinecraftAssets();
+ auto profile = inst->getMinecraftProfile();
+ QString assetName = profile->getMinecraftAssets();
QString asset_fname = "assets/indexes/" + assetName + ".json";
if (!AssetsUtils::loadAssetsIndexJson(asset_fname, &index))
@@ -190,10 +190,10 @@ void OneSixUpdate::jarlibStart()
}
// Build a list of URLs that will need to be downloaded.
- std::shared_ptr<MinecraftProfile> version = inst->getMinecraftProfile();
+ std::shared_ptr<MinecraftProfile> profile = inst->getMinecraftProfile();
// minecraft.jar for this version
{
- QString version_id = version->getMinecraftVersion();
+ QString version_id = profile->getMinecraftVersion();
QString localPath = version_id + "/" + version_id + ".jar";
QString urlstr = "http://" + URLConstants::AWS_DOWNLOAD_VERSIONS + localPath;
@@ -207,8 +207,8 @@ void OneSixUpdate::jarlibStart()
jarlibDownloadJob.reset(job);
}
- auto libs = version->getNativeLibraries();
- libs.append(version->getLibraries());
+ auto libs = profile->getNativeLibraries();
+ libs.append(profile->getLibraries());
auto metacache = ENV.metacache();
QList<ForgeXzDownloadPtr> ForgeLibs;
@@ -289,9 +289,9 @@ void OneSixUpdate::jarlibStart()
void OneSixUpdate::jarlibFinished()
{
OneSixInstance *inst = (OneSixInstance *)m_inst;
- std::shared_ptr<MinecraftProfile> version = inst->getMinecraftProfile();
+ std::shared_ptr<MinecraftProfile> profile = inst->getMinecraftProfile();
- if (version->hasTrait("legacyFML"))
+ if (profile->hasTrait("legacyFML"))
{
fmllibsStart();
}
@@ -313,7 +313,7 @@ void OneSixUpdate::fmllibsStart()
{
// Get the mod list
OneSixInstance *inst = (OneSixInstance *)m_inst;
- std::shared_ptr<MinecraftProfile> fullversion = inst->getMinecraftProfile();
+ std::shared_ptr<MinecraftProfile> profile = inst->getMinecraftProfile();
bool forge_present = false;
QString version = inst->intendedVersionId();
@@ -328,7 +328,7 @@ void OneSixUpdate::fmllibsStart()
// determine if we need some libs for FML or forge
setStatus(tr("Checking for FML libraries..."));
- forge_present = (fullversion->versionPatch("net.minecraftforge") != nullptr);
+ forge_present = (profile->versionPatch("net.minecraftforge") != nullptr);
// we don't...
if (!forge_present)
{