Skip to content

Commit

Permalink
Modify pack screen to load faster
Browse files Browse the repository at this point in the history
Co-Authored-By: IMS <[email protected]>
  • Loading branch information
Asek3 and IMS212 committed Nov 21, 2023
1 parent 7396ee6 commit 15f3255
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
9 changes: 9 additions & 0 deletions src/main/java/net/coderbot/iris/Iris.java
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,11 @@ private static boolean loadExternalShaderpack(String name) {
return false;
}

if (!isValidShaderpack(shaderPackRoot)) {
logger.error("Pack \"{}\" is not valid! Can't load it.", name);
return false;
}

Path shaderPackPath;

if (shaderPackRoot.toString().endsWith(".zip")) {
Expand Down Expand Up @@ -461,6 +466,10 @@ private static void tryUpdateConfigPropertiesFile(Path path, Properties properti
}
}

public static boolean isValidToShowPack(Path pack) {
return Files.isDirectory(pack) || pack.toString().endsWith(".zip");
}

public static boolean isValidShaderpack(Path pack) {
if (Files.isDirectory(pack)) {
// Sometimes the shaderpack directory itself can be
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public Collection<String> enumerate() throws IOException {
};

try (Stream<Path> list = Files.list(root)) {
return list.filter(Iris::isValidShaderpack)
return list.filter(Iris::isValidToShowPack)
.map(path -> path.getFileName().toString())
.sorted(comparator).collect(Collectors.toList());
}
Expand Down

0 comments on commit 15f3255

Please sign in to comment.