diff --git a/build.gradle b/build.gradle index fec231d7..a3c0a9d9 100644 --- a/build.gradle +++ b/build.gradle @@ -16,7 +16,7 @@ plugins { apply plugin: 'org.spongepowered.mixin' group = 'org.embeddedt' -version = '1.1.0' +version = '1.2.0' java { archivesBaseName = 'modernfix-mc' + minecraft_version diff --git a/src/main/java/org/embeddedt/modernfix/mixin/ModFileResourcePackMixin.java b/src/main/java/org/embeddedt/modernfix/mixin/ModFileResourcePackMixin.java index 3413da43..19a596d1 100644 --- a/src/main/java/org/embeddedt/modernfix/mixin/ModFileResourcePackMixin.java +++ b/src/main/java/org/embeddedt/modernfix/mixin/ModFileResourcePackMixin.java @@ -59,7 +59,7 @@ public abstract class ModFileResourcePackMixin { try (Stream stream = Files.walk(root)) { List paths = stream .map(path -> root.relativize(path.toAbsolutePath())) - .filter(path -> !path.toString().endsWith(".mcmeta")) + .filter(this::isValidCachedResourcePath) .collect(Collectors.toList()); rootListingForNamespaces.put(namespace, paths); for(Path path : paths) { @@ -75,6 +75,19 @@ public abstract class ModFileResourcePackMixin { } } + private boolean isValidCachedResourcePath(Path path) { + String str = path.toString(); + if(str.endsWith(".mcmeta")) + return false; + for(int i = 0; i < str.length(); i++) { + if(!ResourceLocation.validPathChar(str.charAt(i))) { + ModernFix.LOGGER.warn("Asset " + str + " does not have a valid resource path and will not be listed"); + return false; + } + } + return true; + } + @Inject(method = "getNamespaces", at = @At("HEAD"), cancellable = true) private void useCacheForNamespaces(ResourcePackType type, CallbackInfoReturnable> cir) { if(useNamespaceCaches) {