mirror of
https://github.com/PrismLauncher/PrismLauncher.git
synced 2025-06-12 05:07:46 +02:00
feat: add basic resource pack parsing of pack.mcmeta
This parses the pack format ID and the description from the local file, from both a ZIP and a folder, and hooks it into the model. Signed-off-by: flow <flowlnlnln@gmail.com>
This commit is contained in:
34
launcher/minecraft/mod/tasks/LocalResourcePackParseTask.h
Normal file
34
launcher/minecraft/mod/tasks/LocalResourcePackParseTask.h
Normal file
@ -0,0 +1,34 @@
|
||||
#pragma once
|
||||
|
||||
#include <QDebug>
|
||||
#include <QObject>
|
||||
|
||||
#include "minecraft/mod/ResourcePack.h"
|
||||
|
||||
#include "tasks/Task.h"
|
||||
|
||||
class LocalResourcePackParseTask : public Task {
|
||||
Q_OBJECT
|
||||
public:
|
||||
LocalResourcePackParseTask(int token, ResourcePack& rp);
|
||||
|
||||
[[nodiscard]] bool canAbort() const override { return true; }
|
||||
bool abort() override;
|
||||
|
||||
void executeTask() override;
|
||||
|
||||
[[nodiscard]] int token() const { return m_token; }
|
||||
|
||||
private:
|
||||
void processMCMeta(QByteArray&& raw_data);
|
||||
|
||||
void processAsFolder();
|
||||
void processAsZip();
|
||||
|
||||
private:
|
||||
int m_token;
|
||||
|
||||
ResourcePack& m_resource_pack;
|
||||
|
||||
bool m_aborted = false;
|
||||
};
|
Reference in New Issue
Block a user