Skip to content

Commit abde202

Browse files
committed
Fix remapping dependencies missing from remapping classpath
1 parent da19f5c commit abde202

2 files changed

Lines changed: 9 additions & 8 deletions

File tree

src/main/java/io/github/fabriccompatibiltylayers/modremappingapi/impl/LibraryHandler.java

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,12 @@
1313
import java.nio.file.Files;
1414
import java.nio.file.Path;
1515
import java.util.ArrayList;
16+
import java.util.HashMap;
1617
import java.util.List;
1718
import java.util.Map;
1819

1920
public 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);

src/main/java/io/github/fabriccompatibiltylayers/modremappingapi/impl/utils/CacheUtils.java

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,7 @@ public static Map<Path, Path> computeLibraryPaths(Collection<Path> sourcePaths,
3636
public static Map<RemapLibrary, Path> computeExtraLibraryPaths(Collection<RemapLibrary> sourcePaths, String target) {
3737
return sourcePaths.stream()
3838
.collect(Collectors.toMap(p -> p,
39-
p -> CacheUtils.getLibraryPath(target).resolve(p.fileName)))
40-
.entrySet()
41-
.stream()
42-
.filter(entry -> !Files.exists(entry.getValue()))
43-
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
39+
p -> CacheUtils.getLibraryPath(target).resolve(p.fileName)));
4440
}
4541

4642
static {

0 commit comments

Comments
 (0)