mirror of
https://github.com/PrismLauncher/PrismLauncher.git
synced 2025-06-13 05:37:42 +02:00
feat: updated flame mod resolution
Signed-off-by: Trial97 <alexandru.tripon97@gmail.com>
This commit is contained in:
@ -87,6 +87,30 @@ void Flame::FileResolvingTask::executeTask()
|
|||||||
m_task->start();
|
m_task->start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PackedResourceType getResourceType(int classId)
|
||||||
|
{
|
||||||
|
switch (classId) {
|
||||||
|
case 17: // Worlds
|
||||||
|
return PackedResourceType::WorldSave;
|
||||||
|
case 6: // Mods
|
||||||
|
return PackedResourceType::Mod;
|
||||||
|
case 12: // Resource Packs
|
||||||
|
// return PackedResourceType::ResourcePack; // not really a resourcepack
|
||||||
|
/* fallthrough */
|
||||||
|
case 4546: // Customization
|
||||||
|
// return PackedResourceType::ShaderPack; // not really a shaderPack
|
||||||
|
/* fallthrough */
|
||||||
|
case 4471: // Modpacks
|
||||||
|
/* fallthrough */
|
||||||
|
case 5: // Bukkit Plugins
|
||||||
|
/* fallthrough */
|
||||||
|
case 4559: // Addons
|
||||||
|
/* fallthrough */
|
||||||
|
default:
|
||||||
|
return PackedResourceType::UNKNOWN;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void Flame::FileResolvingTask::netJobFinished()
|
void Flame::FileResolvingTask::netJobFinished()
|
||||||
{
|
{
|
||||||
setProgress(1, 3);
|
setProgress(1, 3);
|
||||||
@ -232,6 +256,10 @@ void Flame::FileResolvingTask::getFlameProjects()
|
|||||||
|
|
||||||
setStatus(tr("Parsing API response from CurseForge for '%1'...").arg(file->version.fileName));
|
setStatus(tr("Parsing API response from CurseForge for '%1'...").arg(file->version.fileName));
|
||||||
FlameMod::loadIndexedPack(file->pack, entry_obj);
|
FlameMod::loadIndexedPack(file->pack, entry_obj);
|
||||||
|
file->resourceType = getResourceType(Json::requireInteger(entry_obj, "classId", "modClassId"));
|
||||||
|
if (file->resourceType == PackedResourceType::WorldSave) {
|
||||||
|
file->targetFolder = "saves";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} catch (Json::JsonException& e) {
|
} catch (Json::JsonException& e) {
|
||||||
qDebug() << e.cause();
|
qDebug() << e.cause();
|
||||||
|
@ -474,7 +474,7 @@ void FlameCreationTask::idResolverSucceeded(QEventLoop& loop)
|
|||||||
QList<BlockedMod> blocked_mods;
|
QList<BlockedMod> blocked_mods;
|
||||||
auto anyBlocked = false;
|
auto anyBlocked = false;
|
||||||
for (const auto& result : results.files.values()) {
|
for (const auto& result : results.files.values()) {
|
||||||
if (result.version.fileName.endsWith(".zip")) {
|
if (result.resourceType != PackedResourceType::Mod) {
|
||||||
m_ZIP_resources.append(std::make_pair(result.version.fileName, result.targetFolder));
|
m_ZIP_resources.append(std::make_pair(result.version.fileName, result.targetFolder));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -678,6 +678,7 @@ void FlameCreationTask::validateZIPResources(QEventLoop& loop)
|
|||||||
installWorld(worldPath);
|
installWorld(worldPath);
|
||||||
break;
|
break;
|
||||||
case PackedResourceType::UNKNOWN:
|
case PackedResourceType::UNKNOWN:
|
||||||
|
/* fallthrough */
|
||||||
default:
|
default:
|
||||||
qDebug() << "Can't Identify" << fileName << "at" << localPath << ", leaving it where it is.";
|
qDebug() << "Can't Identify" << fileName << "at" << localPath << ", leaving it where it is.";
|
||||||
break;
|
break;
|
||||||
|
@ -40,6 +40,7 @@
|
|||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QUrl>
|
#include <QUrl>
|
||||||
#include <QVector>
|
#include <QVector>
|
||||||
|
#include "minecraft/mod/tasks/LocalResourceParse.h"
|
||||||
#include "modplatform/ModIndex.h"
|
#include "modplatform/ModIndex.h"
|
||||||
|
|
||||||
namespace Flame {
|
namespace Flame {
|
||||||
@ -54,6 +55,8 @@ struct File {
|
|||||||
|
|
||||||
// our
|
// our
|
||||||
QString targetFolder = QStringLiteral("mods");
|
QString targetFolder = QStringLiteral("mods");
|
||||||
|
enum class Type { Unknown, Folder, Ctoc, SingleFile, Cmod2, Modpack, Mod } type = Type::Mod;
|
||||||
|
PackedResourceType resourceType;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Modloader {
|
struct Modloader {
|
||||||
|
Reference in New Issue
Block a user