parent
99ee81ab78
commit
dc18e782c4
|
|
@ -16,7 +16,7 @@ plugins {
|
||||||
apply plugin: 'org.spongepowered.mixin'
|
apply plugin: 'org.spongepowered.mixin'
|
||||||
|
|
||||||
group = 'org.embeddedt'
|
group = 'org.embeddedt'
|
||||||
version = '1.1.0'
|
version = '1.2.0'
|
||||||
|
|
||||||
java {
|
java {
|
||||||
archivesBaseName = 'modernfix-mc' + minecraft_version
|
archivesBaseName = 'modernfix-mc' + minecraft_version
|
||||||
|
|
|
||||||
|
|
@ -59,7 +59,7 @@ public abstract class ModFileResourcePackMixin {
|
||||||
try (Stream<Path> stream = Files.walk(root)) {
|
try (Stream<Path> stream = Files.walk(root)) {
|
||||||
List<Path> paths = stream
|
List<Path> paths = stream
|
||||||
.map(path -> root.relativize(path.toAbsolutePath()))
|
.map(path -> root.relativize(path.toAbsolutePath()))
|
||||||
.filter(path -> !path.toString().endsWith(".mcmeta"))
|
.filter(this::isValidCachedResourcePath)
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
rootListingForNamespaces.put(namespace, paths);
|
rootListingForNamespaces.put(namespace, paths);
|
||||||
for(Path path : 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)
|
@Inject(method = "getNamespaces", at = @At("HEAD"), cancellable = true)
|
||||||
private void useCacheForNamespaces(ResourcePackType type, CallbackInfoReturnable<Set<String>> cir) {
|
private void useCacheForNamespaces(ResourcePackType type, CallbackInfoReturnable<Set<String>> cir) {
|
||||||
if(useNamespaceCaches) {
|
if(useNamespaceCaches) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user