Skip to content

Commit

Permalink
Fix resource pack cache engine being unable to list resource stacks f…
Browse files Browse the repository at this point in the history
…or files
  • Loading branch information
embeddedt committed Feb 1, 2024
1 parent df9d280 commit 81c4980
Showing 1 changed file with 4 additions and 2 deletions.
Expand Up @@ -60,7 +60,7 @@ public PackResourcesCacheEngine(Function<PackType, Set<String>> namespacesRetrie
String namespace = pair.getFirst();
Path root = pair.getSecond();
String[] prefix = new String[] { type.getDirectory(), namespace };
try (Stream<Path> stream = Files.walk(root)) {
try (Stream<Path> stream = Files.find(root, Integer.MAX_VALUE, (p, a) -> a.isRegularFile())) {
stream
.map(path -> root.relativize(path.toAbsolutePath()))
.filter(PackResourcesCacheEngine::isValidCachedResourcePath)
Expand Down Expand Up @@ -154,8 +154,10 @@ public Collection<ResourceLocation> getResources(PackType type, String resourceN
if((cachePath.getNameCount() - 2) > maxDepth)
continue;
String fullPath = cachePath.getFullPath(2);
if(!fullPath.startsWith(testPath))
String fullTestPath = fullPath.endsWith("/") ? fullPath : (fullPath + "/");
if(!fullTestPath.startsWith(testPath)) {
continue;
}
ResourceLocation foundResource = new ResourceLocation(resourceNamespace, fullPath);
if(!filter.test(foundResource))
continue;
Expand Down

0 comments on commit 81c4980

Please sign in to comment.