Fix ModList cache never being updated (#5081)

This commit is contained in:
Pyrofab 2018-08-16 20:54:56 +02:00 committed by LexManos
parent 21097a4122
commit dd0c251b3d
2 changed files with 5 additions and 3 deletions

View file

@ -99,8 +99,11 @@ public class LibraryManager
for (ModList list : ModList.getKnownLists(minecraftHome)) for (ModList list : ModList.getKnownLists(minecraftHome))
{ {
Repository repo = list.getRepository() == null ? libraries_dir : list.getRepository(); Repository repo = list.getRepository() == null ? libraries_dir : list.getRepository();
for (Artifact artifact : list.getArtifacts()) List<Artifact> artifacts = list.getArtifacts();
// extractPacked adds artifacts to the list. As such, we can't use an Iterator to traverse it.
for (int i = 0; i < artifacts.size(); i++)
{ {
Artifact artifact = artifacts.get(i);
Artifact resolved = repo.resolve(artifact); Artifact resolved = repo.resolve(artifact);
if (resolved != null) if (resolved != null)
{ {

View file

@ -50,8 +50,7 @@ public class ModList
try try
{ {
String key = json.getCanonicalFile().getAbsolutePath(); String key = json.getCanonicalFile().getAbsolutePath();
if (cache.containsKey(key)) return cache.computeIfAbsent(key, k -> new ModList(json, mcdir));
return cache.get(key);
} }
catch (IOException e) catch (IOException e)
{ {