aboutsummaryrefslogtreecommitdiff
path: root/launcher/minecraft/mod
diff options
context:
space:
mode:
authorRyan Cao <70191398+ryanccn@users.noreply.github.com>2022-11-19 23:38:05 +0800
committerRyan Cao <70191398+ryanccn@users.noreply.github.com>2022-11-19 23:38:05 +0800
commitb1bdc6f745d607af4dc1bb592003a538ee03f058 (patch)
tree2e9bddf73a4c15ef526f0ad6c549366dfe76ca3f /launcher/minecraft/mod
parent8dacbafc8ba45ae6c2b770da77cc0d3d632849ba (diff)
downloadPrismLauncher-b1bdc6f745d607af4dc1bb592003a538ee03f058.tar.gz
PrismLauncher-b1bdc6f745d607af4dc1bb592003a538ee03f058.tar.bz2
PrismLauncher-b1bdc6f745d607af4dc1bb592003a538ee03f058.zip
fix resource packs and add support for texture packs
Signed-off-by: Ryan Cao <70191398+ryanccn@users.noreply.github.com>
Diffstat (limited to 'launcher/minecraft/mod')
-rw-r--r--launcher/minecraft/mod/ResourcePack.cpp5
-rw-r--r--launcher/minecraft/mod/ResourcePack.h2
-rw-r--r--launcher/minecraft/mod/TexturePack.cpp5
-rw-r--r--launcher/minecraft/mod/TexturePack.h2
4 files changed, 14 insertions, 0 deletions
diff --git a/launcher/minecraft/mod/ResourcePack.cpp b/launcher/minecraft/mod/ResourcePack.cpp
index 3fc10a2f..9f46cd2c 100644
--- a/launcher/minecraft/mod/ResourcePack.cpp
+++ b/launcher/minecraft/mod/ResourcePack.cpp
@@ -114,3 +114,8 @@ bool ResourcePack::applyFilter(QRegularExpression filter) const
return Resource::applyFilter(filter);
}
+
+bool ResourcePack::valid() const
+{
+ return m_pack_format != 0;
+}
diff --git a/launcher/minecraft/mod/ResourcePack.h b/launcher/minecraft/mod/ResourcePack.h
index 03121908..7cb414d8 100644
--- a/launcher/minecraft/mod/ResourcePack.h
+++ b/launcher/minecraft/mod/ResourcePack.h
@@ -42,6 +42,8 @@ class ResourcePack : public Resource {
/** Thread-safe. */
void setImage(QImage new_image);
+ bool valid() const override;
+
[[nodiscard]] auto compare(Resource const& other, SortType type) const -> std::pair<int, bool> override;
[[nodiscard]] bool applyFilter(QRegularExpression filter) const override;
diff --git a/launcher/minecraft/mod/TexturePack.cpp b/launcher/minecraft/mod/TexturePack.cpp
index 796eb69d..99d55584 100644
--- a/launcher/minecraft/mod/TexturePack.cpp
+++ b/launcher/minecraft/mod/TexturePack.cpp
@@ -62,3 +62,8 @@ QPixmap TexturePack::image(QSize size)
TexturePackUtils::process(*this);
return image(size);
}
+
+bool TexturePack::valid() const
+{
+ return m_description != nullptr;
+}
diff --git a/launcher/minecraft/mod/TexturePack.h b/launcher/minecraft/mod/TexturePack.h
index 6aa5e18e..81bd5c69 100644
--- a/launcher/minecraft/mod/TexturePack.h
+++ b/launcher/minecraft/mod/TexturePack.h
@@ -48,6 +48,8 @@ class TexturePack : public Resource {
/** Thread-safe. */
void setImage(QImage new_image);
+ bool valid() const override;
+
protected:
mutable QMutex m_data_lock;