diff options
Diffstat (limited to 'api/logic/minecraft/MinecraftInstance.cpp')
-rw-r--r-- | api/logic/minecraft/MinecraftInstance.cpp | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/api/logic/minecraft/MinecraftInstance.cpp b/api/logic/minecraft/MinecraftInstance.cpp index bf4eb1bd..449a2ed5 100644 --- a/api/logic/minecraft/MinecraftInstance.cpp +++ b/api/logic/minecraft/MinecraftInstance.cpp @@ -20,6 +20,7 @@ #include "minecraft/launch/DirectJavaLaunch.h" #include "minecraft/launch/ModMinecraftJar.h" #include "minecraft/launch/ClaimAccount.h" +#include "minecraft/launch/ReconstructAssets.h" #include "java/launch/CheckJava.h" #include "java/JavaUtils.h" #include "meta/Index.h" @@ -216,6 +217,11 @@ QString MinecraftInstance::worldDir() const return FS::PathCombine(gameRoot(), "saves"); } +QString MinecraftInstance::resourcesDir() const +{ + return FS::PathCombine(gameRoot(), "resources"); +} + QDir MinecraftInstance::librariesPath() const { return QDir::current().absoluteFilePath("libraries"); @@ -408,8 +414,7 @@ QStringList MinecraftInstance::processMinecraftArgs(AuthSessionPtr session) cons token_mapping["game_directory"] = absRootDir; QString absAssetsDir = QDir("assets/").absolutePath(); auto assets = profile->getMinecraftAssets(); - // FIXME: this is wrong and should be run as an async task - token_mapping["game_assets"] = AssetsUtils::reconstructAssets(assets->id).absolutePath(); + token_mapping["game_assets"] = AssetsUtils::getAssetsDir(assets->id, resourcesDir()).absolutePath(); // 1.7.3+ assets tokens token_mapping["assets_root"] = absAssetsDir; @@ -842,6 +847,12 @@ std::shared_ptr<LaunchTask> MinecraftInstance::createLaunchTask(AuthSessionPtr s process->appendStep(step); } + // reconstruct assets if needed + { + auto step = std::make_shared<ReconstructAssets>(pptr); + process->appendStep(step); + } + { // actually launch the game auto method = launchMethod(); |