diff options
author | flow <flowlnlnln@gmail.com> | 2022-06-07 22:32:13 -0300 |
---|---|---|
committer | flow <flowlnlnln@gmail.com> | 2022-06-12 09:25:25 -0300 |
commit | 9f1f37e78023d66ce01481c05fa73db9eba0882a (patch) | |
tree | 123548da98961266fdb209abcd6992201ba546e3 /launcher/minecraft/mod/tasks | |
parent | 40ccd1a46910012f80285f7b6982a5919e2a9dcf (diff) | |
download | PrismLauncher-9f1f37e78023d66ce01481c05fa73db9eba0882a.tar.gz PrismLauncher-9f1f37e78023d66ce01481c05fa73db9eba0882a.tar.bz2 PrismLauncher-9f1f37e78023d66ce01481c05fa73db9eba0882a.zip |
fix: correctly handle disabled mods with metadata
im stupid
Diffstat (limited to 'launcher/minecraft/mod/tasks')
-rw-r--r-- | launcher/minecraft/mod/tasks/ModFolderLoadTask.cpp | 29 |
1 files changed, 24 insertions, 5 deletions
diff --git a/launcher/minecraft/mod/tasks/ModFolderLoadTask.cpp b/launcher/minecraft/mod/tasks/ModFolderLoadTask.cpp index 62d856f6..bde32b3e 100644 --- a/launcher/minecraft/mod/tasks/ModFolderLoadTask.cpp +++ b/launcher/minecraft/mod/tasks/ModFolderLoadTask.cpp @@ -53,12 +53,31 @@ void ModFolderLoadTask::run() m_mods_dir.refresh(); for (auto entry : m_mods_dir.entryInfoList()) { Mod mod(entry); - if(m_result->mods.contains(mod.internal_id())){ - m_result->mods[mod.internal_id()].setStatus(ModStatus::Installed); + + if (mod.enabled()) { + if (m_result->mods.contains(mod.internal_id())) { + m_result->mods[mod.internal_id()].setStatus(ModStatus::Installed); + } + else { + m_result->mods[mod.internal_id()] = mod; + m_result->mods[mod.internal_id()].setStatus(ModStatus::NoMetadata); + } } - else { - m_result->mods[mod.internal_id()] = mod; - m_result->mods[mod.internal_id()].setStatus(ModStatus::NoMetadata); + else { + QString chopped_id = mod.internal_id().chopped(9); + if (m_result->mods.contains(chopped_id)) { + m_result->mods[mod.internal_id()] = mod; + + auto metadata = m_result->mods[chopped_id].metadata(); + mod.setMetadata(new Metadata::ModStruct(*metadata)); + + m_result->mods[mod.internal_id()].setStatus(ModStatus::Installed); + m_result->mods.remove(chopped_id); + } + else { + m_result->mods[mod.internal_id()] = mod; + m_result->mods[mod.internal_id()].setStatus(ModStatus::NoMetadata); + } } } |