Restrict resource pack cache to assets/ and data/ folders

This commit is contained in:
embeddedt 2024-01-13 11:14:59 -05:00
parent 03e7df5308
commit d7146a0667
No known key found for this signature in database
GPG Key ID: A69433EC199B5613
2 changed files with 2 additions and 2 deletions

View File

@ -58,7 +58,7 @@ public abstract class ModNioResourcePackMixin implements ICachingResourcePack {
@Inject(method = "hasResource", at = @At(value = "INVOKE", target = "Lnet/fabricmc/fabric/impl/resource/loader/ModNioResourcePack;getPath(Ljava/lang/String;)Ljava/nio/file/Path;"), cancellable = true)
private void useCacheForExistence(String path, CallbackInfoReturnable<Boolean> cir) {
if(cacheEngine != null)
if(cacheEngine != null && (path.startsWith("assets/") || path.startsWith("data/")))
cir.setReturnValue(this.cacheEngine.hasResource(path));
}
}

View File

@ -56,7 +56,7 @@ public abstract class ModFileResourcePackMixin implements ICachingResourcePack {
@Inject(method = "hasResource(Ljava/lang/String;)Z", at = @At(value = "HEAD"), cancellable = true)
private void useCacheForExistence(String path, CallbackInfoReturnable<Boolean> cir) {
if(cacheEngine != null)
if(cacheEngine != null && (path.startsWith("assets/") || path.startsWith("data/")))
cir.setReturnValue(this.cacheEngine.hasResource(path));
}