1313import java .nio .file .Files ;
1414import java .nio .file .Path ;
1515import java .util .ArrayList ;
16+ import java .util .HashMap ;
1617import java .util .List ;
1718import java .util .Map ;
1819
1920public class LibraryHandler {
20- private static Map <RemapLibrary , Path > remapLibraries ;
21+ private static final Map <RemapLibrary , Path > remapLibraries = new HashMap <>() ;
2122
2223 public static void gatherRemapLibraries (List <ModRemapper > remappers ) {
2324 try {
@@ -26,12 +27,14 @@ public static void gatherRemapLibraries(List<ModRemapper> remappers) {
2627
2728 remapper .addRemapLibraries (libraries , FabricLoader .getInstance ().getEnvironmentType ());
2829
29- remapLibraries = CacheUtils .computeExtraLibraryPaths (libraries , MappingsUtilsImpl .getSourceNamespace ());
30+ Map < RemapLibrary , Path > temp = CacheUtils .computeExtraLibraryPaths (libraries , MappingsUtilsImpl .getSourceNamespace ());
3031
31- for (Map .Entry <RemapLibrary , Path > entry : remapLibraries .entrySet ()) {
32+ for (Map .Entry <RemapLibrary , Path > entry : temp .entrySet ()) {
3233 RemapLibrary library = entry .getKey ();
3334 Path path = entry .getValue ();
3435
36+ if (Files .exists (path )) continue ;
37+
3538 if (!library .url .isEmpty ()) {
3639 Constants .MAIN_LOGGER .info ("Downloading remapping library '" + library .fileName + "' from url '" + library .url + "'" );
3740 FileUtils .downloadFile (library .url , path );
@@ -43,6 +46,8 @@ public static void gatherRemapLibraries(List<ModRemapper> remappers) {
4346 Constants .MAIN_LOGGER .info ("Remapping library ready for use." );
4447 }
4548 }
49+
50+ remapLibraries .putAll (temp );
4651 }
4752 } catch (IOException | URISyntaxException e ) {
4853 throw new RuntimeException (e );
0 commit comments