Skip to content
This repository was archived by the owner on Dec 30, 2022. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/main/java/xyz/deathsgun/modmanager/util/FabricMods.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import com.google.gson.Gson;
import net.fabricmc.loader.api.FabricLoader;
import net.fabricmc.loader.api.ModContainer;
import org.apache.logging.log4j.LogManager;
import xyz.deathsgun.modmanager.api.mod.SummarizedMod;
import xyz.deathsgun.modmanager.model.ReducedModMetadata;

Expand Down Expand Up @@ -47,6 +48,10 @@ public static Path getJarFromModContainer(String id, String name) throws Excepti
for (Path path : jars) {
ZipFile zipFile = new ZipFile(path.toFile());
ZipEntry entry = zipFile.getEntry("fabric.mod.json");
if (entry == null) {
LogManager.getLogger().warn("No fabric.mod.json found in {}", path);
continue;
}
ReducedModMetadata metadata = gson.fromJson(new InputStreamReader(zipFile.getInputStream(entry)), ReducedModMetadata.class);
zipFile.close();
if (metadata.getId().equals(id) || metadata.getName().equals(name)) {
Expand Down