From db0cb4ef2a2ce995e3da547502ca81148283674f Mon Sep 17 00:00:00 2001 From: Lilly Rose Berner Date: Mon, 14 Oct 2024 05:59:07 +0200 Subject: [PATCH] Fix mod addition feature not recognizing Quilt mods (#789) - Fix drag-n-drop not supporting Quilt mods --- .../com/terraformersmc/modmenu/gui/ModsScreen.java | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/terraformersmc/modmenu/gui/ModsScreen.java b/src/main/java/com/terraformersmc/modmenu/gui/ModsScreen.java index c5c30d3e..090f875b 100644 --- a/src/main/java/com/terraformersmc/modmenu/gui/ModsScreen.java +++ b/src/main/java/com/terraformersmc/modmenu/gui/ModsScreen.java @@ -600,7 +600,7 @@ public void filesDragged(List paths) { Path modsDirectory = FabricLoader.getInstance().getGameDir().resolve("mods"); // Filter out none mods - List mods = paths.stream().filter(ModsScreen::isFabricMod).collect(Collectors.toList()); + List mods = paths.stream().filter(ModsScreen::isValidMod).collect(Collectors.toList()); if (mods.isEmpty()) { return; @@ -638,9 +638,15 @@ public void filesDragged(List paths) { }, ModMenuScreenTexts.DROP_CONFIRM, Text.literal(modList))); } - private static boolean isFabricMod(Path mod) { + private static boolean isValidMod(Path mod) { try (JarFile jarFile = new JarFile(mod.toFile())) { - return jarFile.getEntry("fabric.mod.json") != null; + var isFabricMod = jarFile.getEntry("fabric.mod.json") != null; + + if (!ModMenu.RUNNING_QUILT) { + return isFabricMod; + } else { + return isFabricMod || jarFile.getEntry("quilt.mod.json") != null; + } } catch (IOException e) { return false; }