Skip to content

Commit

Permalink
Fix default extraction state
Browse files Browse the repository at this point in the history
  • Loading branch information
lukebemish committed Mar 8, 2024
1 parent df08c45 commit a11b058
Showing 1 changed file with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,16 @@ private static Config readFromConfig() {
}
var map = new ConcurrentHashMap<>(config.extract());
Services.PLATFORM.getExistingModdedPaths(DefaultResources.META_FILE_PATH).forEach((modId, metaPath) -> {
if (!map.containsKey(modId)) {
map.put(modId, ExtractionState.UNEXTRACTED);
try (var is = Files.newInputStream(metaPath)) {
JsonElement object = DefaultResources.GSON.fromJson(new InputStreamReader(is), JsonElement.class);
ModMetaFile metaFile = ModMetaFile.CODEC.parse(JsonOps.INSTANCE, object).getOrThrow(false, e -> {
});
if (!map.containsKey(modId)) {
map.put(modId, metaFile.extract() ? ExtractionState.EXTRACT : ExtractionState.UNEXTRACTED);
}
} catch (IOException | RuntimeException e) {
DefaultResources.LOGGER.warn("We thought there was a readable {} for mod {}, but we got an error when reading it!",
DefaultResources.META_FILE_PATH, modId, e);
}
});

Expand Down

0 comments on commit a11b058

Please sign in to comment.