From 03b75bf2a98edd4114be4799f974bb10fe9b82c4 Mon Sep 17 00:00:00 2001
From: Rachel Powers <508861+Ryex@users.noreply.github.com>
Date: Fri, 30 Dec 2022 18:06:17 -0700
Subject: feat: Import all the things!
Signed-off-by: Rachel Powers <508861+Ryex@users.noreply.github.com>
---
.../minecraft/mod/tasks/LocalDataPackParseTask.cpp | 4 ++--
launcher/minecraft/mod/tasks/LocalResourceParse.cpp | 21 +++++++++++++++++++++
launcher/minecraft/mod/tasks/LocalResourceParse.h | 6 ++++++
3 files changed, 29 insertions(+), 2 deletions(-)
(limited to 'launcher/minecraft/mod/tasks')
diff --git a/launcher/minecraft/mod/tasks/LocalDataPackParseTask.cpp b/launcher/minecraft/mod/tasks/LocalDataPackParseTask.cpp
index 3fcb2110..5bb44877 100644
--- a/launcher/minecraft/mod/tasks/LocalDataPackParseTask.cpp
+++ b/launcher/minecraft/mod/tasks/LocalDataPackParseTask.cpp
@@ -50,7 +50,7 @@ bool processFolder(DataPack& pack, ProcessingLevel level)
Q_ASSERT(pack.type() == ResourceType::FOLDER);
auto mcmeta_invalid = [&pack]() {
- qWarning() << "Resource pack at" << pack.fileinfo().filePath() << "does not have a valid pack.mcmeta";
+ qWarning() << "Data pack at" << pack.fileinfo().filePath() << "does not have a valid pack.mcmeta";
return false; // the mcmeta is not optional
};
@@ -95,7 +95,7 @@ bool processZIP(DataPack& pack, ProcessingLevel level)
QuaZipFile file(&zip);
auto mcmeta_invalid = [&pack]() {
- qWarning() << "Resource pack at" << pack.fileinfo().filePath() << "does not have a valid pack.mcmeta";
+ qWarning() << "Data pack at" << pack.fileinfo().filePath() << "does not have a valid pack.mcmeta";
return false; // the mcmeta is not optional
};
diff --git a/launcher/minecraft/mod/tasks/LocalResourceParse.cpp b/launcher/minecraft/mod/tasks/LocalResourceParse.cpp
index 19ddc899..63833832 100644
--- a/launcher/minecraft/mod/tasks/LocalResourceParse.cpp
+++ b/launcher/minecraft/mod/tasks/LocalResourceParse.cpp
@@ -19,6 +19,8 @@
* along with this program. If not, see .
*/
+#include
+
#include "LocalResourceParse.h"
#include "LocalDataPackParseTask.h"
@@ -28,6 +30,17 @@
#include "LocalTexturePackParseTask.h"
#include "LocalWorldSaveParseTask.h"
+
+static const QMap s_packed_type_names = {
+ {PackedResourceType::ResourcePack, QObject::tr("resource pack")},
+ {PackedResourceType::TexturePack, QObject::tr("texture pack")},
+ {PackedResourceType::DataPack, QObject::tr("data pack")},
+ {PackedResourceType::ShaderPack, QObject::tr("shader pack")},
+ {PackedResourceType::WorldSave, QObject::tr("world save")},
+ {PackedResourceType::Mod , QObject::tr("mod")},
+ {PackedResourceType::UNKNOWN, QObject::tr("unknown")}
+};
+
namespace ResourceUtils {
PackedResourceType identify(QFileInfo file){
if (file.exists() && file.isFile()) {
@@ -57,4 +70,12 @@ PackedResourceType identify(QFileInfo file){
}
return PackedResourceType::UNKNOWN;
}
+
+QString getPackedTypeName(PackedResourceType type) {
+ return s_packed_type_names.constFind(type).value();
}
+
+}
+
+
+
diff --git a/launcher/minecraft/mod/tasks/LocalResourceParse.h b/launcher/minecraft/mod/tasks/LocalResourceParse.h
index b07a874c..7385d24b 100644
--- a/launcher/minecraft/mod/tasks/LocalResourceParse.h
+++ b/launcher/minecraft/mod/tasks/LocalResourceParse.h
@@ -21,11 +21,17 @@
#pragma once
+#include
+
#include
#include
#include
enum class PackedResourceType { DataPack, ResourcePack, TexturePack, ShaderPack, WorldSave, Mod, UNKNOWN };
namespace ResourceUtils {
+static const std::set ValidResourceTypes = { PackedResourceType::DataPack, PackedResourceType::ResourcePack,
+ PackedResourceType::TexturePack, PackedResourceType::ShaderPack,
+ PackedResourceType::WorldSave, PackedResourceType::Mod };
PackedResourceType identify(QFileInfo file);
+QString getPackedTypeName(PackedResourceType type);
} // namespace ResourceUtils
--
cgit