Cache resource listing calls in resource packs (#8829)

* Make the resource lookups cached.

* Include configurability and handle patch cleanup.

* Document and comment the cache manager.

* Make thread selection configurable.

* Implement a configurable loading mechanic that falls back to default behaviour when the config is not bound yet.

* Use boolean supplier and fix wildcard import.

* Clean up the VPR since this is more elegant.

* Clean up the VPR since this is more elegant.

* Address review comments.

* Address more review comments.

* Fix formatting on `getSource`

* Address comments by ichtt

* Adapt to pups requests.

* Stupid idea.

* Attempt this again with a copy on write list.

* Fix a concurrency and loading issue.

* Fix #8813
Checks if the paths are valid resource paths.

* Move the new methods on vanilla Patch.
This commit is contained in:
Marc Hermans authored and GitHub committed 2022-07-09 10:58:11 -04:00
1 parent 57f45eaca0
commit b70d99489b
10 files changed
+594 -30

No files matched your search

@@ -83,10 +83,33 @@ public class ForgeConfig {
* General configuration that doesn't need to be synchronized but needs to be available before server startup
*/
public static class Common {
public final BooleanValue cachePackAccess;
public final BooleanValue indexVanillaPackCachesOnThread;
public final BooleanValue indexModPackCachesOnThread;
Common(ForgeConfigSpec.Builder builder) {
builder.comment("General configuration settings")
.push("general");
cachePackAccess = builder
.comment("Set this to true to cache resource listings in resource and data packs")
.translation("forge.configgui.cachePackAccess")
.worldRestart()
.define("cachePackAccess", true);
indexVanillaPackCachesOnThread = builder
.comment("Set this to true to index vanilla resource and data packs on thread")
.translation("forge.configgui.indexVanillaPackCachesOnThread")
.worldRestart()
.define("indexVanillaPackCachesOnThread", false);
indexModPackCachesOnThread = builder
.comment("Set this to true to index mod resource and data packs on thread")
.translation("forge.configgui.indexModPackCachesOnThread")
.worldRestart()
.define("indexModPackCachesOnThread", false);
builder.pop();
}
}
@@ -5,10 +5,16 @@
package net.minecraftforge.common.extensions;
import net.minecraft.server.packs.PackType;
public interface IForgePackResources
{
default boolean isHidden()
{
return false;
}
default void initForNamespace(final String nameSpace) {}
default void init(final PackType packType) {}
}