Make ReverseTagWrapper unmodifiable, fix error in log when mods folder doesn't exist initial scan.
This commit is contained in:
parent
604987a005
commit
002e29958e
|
@ -18,6 +18,7 @@ public class ModDirTransformerDiscoverer implements ITransformerDiscoveryService
|
||||||
final Path modsDir = gameDirectory.resolve(FMLPaths.MODSDIR.relative());
|
final Path modsDir = gameDirectory.resolve(FMLPaths.MODSDIR.relative());
|
||||||
List<Path> paths = new ArrayList<>();
|
List<Path> paths = new ArrayList<>();
|
||||||
try {
|
try {
|
||||||
|
Files.createDirectories(modsDir);
|
||||||
Files.walk(modsDir, 1).forEach(p -> {
|
Files.walk(modsDir, 1).forEach(p -> {
|
||||||
if (!Files.isRegularFile(p)) return;
|
if (!Files.isRegularFile(p)) return;
|
||||||
if (!p.toString().endsWith(".jar")) return;
|
if (!p.toString().endsWith(".jar")) return;
|
||||||
|
@ -35,4 +36,4 @@ public class ModDirTransformerDiscoverer implements ITransformerDiscoveryService
|
||||||
}
|
}
|
||||||
return paths;
|
return paths;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
|
|
||||||
package net.minecraftforge.common.util;
|
package net.minecraftforge.common.util;
|
||||||
|
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.function.IntSupplier;
|
import java.util.function.IntSupplier;
|
||||||
|
@ -47,7 +48,7 @@ public class ReverseTagWrapper<T>
|
||||||
{
|
{
|
||||||
if (cache == null || generation != genSupplier.getAsInt())
|
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();
|
this.generation = genSupplier.getAsInt();
|
||||||
}
|
}
|
||||||
return this.cache;
|
return this.cache;
|
||||||
|
|
Loading…
Reference in New Issue