From 6db657588a071c934a563e5363ed9c2632635b1f Mon Sep 17 00:00:00 2001 From: Darien Johnson <84008186+CADIndie@users.noreply.github.com> Date: Sun, 3 Nov 2024 02:07:43 -0600 Subject: [PATCH] Fix Resource Pack Downloading --- .../pojlib/util/json/MinecraftInstances.java | 20 +++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/src/main/java/pojlib/util/json/MinecraftInstances.java b/src/main/java/pojlib/util/json/MinecraftInstances.java index 03d9f8b1..c211576c 100644 --- a/src/main/java/pojlib/util/json/MinecraftInstances.java +++ b/src/main/java/pojlib/util/json/MinecraftInstances.java @@ -118,7 +118,10 @@ private void removeModByType(List oldMods, List newMod if(!remove) { newExtProjects.add(extProject); } else { - File mod = new File(gameDir + (extProject.type.equals("mod") ? "/mods" : "/resourcepacks"), extProject.slug + ".jar"); + File mod = new File( + gameDir + (extProject.type.equals("mod") ? "/mods" : "/resourcepacks"), + extProject.slug + (extProject.type.equals("resourcepack") ? ".zip" : ".jar") + ); if(mod.exists()) { mod.delete(); } @@ -165,7 +168,10 @@ private void updateModByType(List newMods) throws IOException { continue; } manual = false; - File mod = new File(gameDir + (newMod.type.equals("mod") ? "/mods" : "/resourcepacks"), newMod.slug + ".jar"); + File mod = new File( + gameDir + (newMod.type.equals("mod") ? "/mods" : "/resourcepacks"), + newMod.slug + (newMod.type.equals("resourcepack") ? ".zip" : ".jar") + ); if(!mod.exists() || !extMod.version.equals(newMod.version)) { DownloadUtils.downloadFile(newMod.download_link, mod); extMod = newMod; @@ -173,7 +179,10 @@ private void updateModByType(List newMods) throws IOException { } } if(manual) { - File mod = new File(gameDir + (extMod.type.equals("mod") ? "/mods" : "/resourcepacks"), extMod.slug + ".jar"); + File mod = new File( + gameDir + (extMod.type.equals("mod") ? "/mods" : "/resourcepacks"), + extMod.slug + (extMod.type.equals("resourcepack") ? ".zip" : ".jar") + ); if(!mod.exists()) { DownloadUtils.downloadFile(extMod.download_link, mod); } @@ -186,7 +195,10 @@ private void updateModByType(List newMods) throws IOException { private void downloadAllMods(List newMods) throws IOException { for(ProjectInfo newMod : newMods) { - File mod = new File(gameDir + (newMod.type.equals("mod") ? "/mods" : "/resourcepacks"), newMod.slug + ".jar"); + File mod = new File( + gameDir + (newMod.type.equals("mod") ? "/mods" : "/resourcepacks"), + newMod.slug + (newMod.type.equals("resourcepack") ? ".zip" : ".jar") + ); DownloadUtils.downloadFile(newMod.download_link, mod); }