Make ReverseTagWrapper unmodifiable, fix error in log when mods folder doesn't exist initial scan.

This commit is contained in:
LexManos 2019-06-16 00:47:40 -07:00
parent 604987a005
commit 002e29958e
2 changed files with 4 additions and 2 deletions

View File

@ -18,6 +18,7 @@ public class ModDirTransformerDiscoverer implements ITransformerDiscoveryService
final Path modsDir = gameDirectory.resolve(FMLPaths.MODSDIR.relative());
List<Path> paths = new ArrayList<>();
try {
Files.createDirectories(modsDir);
Files.walk(modsDir, 1).forEach(p -> {
if (!Files.isRegularFile(p)) return;
if (!p.toString().endsWith(".jar")) return;
@ -35,4 +36,4 @@ public class ModDirTransformerDiscoverer implements ITransformerDiscoveryService
}
return paths;
}
}
}

View File

@ -19,6 +19,7 @@
package net.minecraftforge.common.util;
import java.util.Collections;
import java.util.HashSet;
import java.util.Set;
import java.util.function.IntSupplier;
@ -47,7 +48,7 @@ public class ReverseTagWrapper<T>
{
if (cache == null || generation != genSupplier.getAsInt())
{
this.cache = new HashSet<>(colSupplier.get().getOwningTags(target));
this.cache = Collections.unmodifiableSet(new HashSet<>(colSupplier.get().getOwningTags(target)));
this.generation = genSupplier.getAsInt();
}
return this.cache;