mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-20 04:09:51 +00:00
[1.18.x] Backport: Cache resource listing calls in resource packs (#8868)
This commit is contained in:
1 parent
49c927a505
commit
4df024ef43
10 files changed
+561
-8
No files matched your search
@@ -26,8 +26,8 @@ public class DelegatingResourcePack extends AbstractPackResources
|
||||
{
|
||||
|
||||
private final List<PackResources> delegates;
|
||||
private final Map<String, List<PackResources>> namespacesAssets;
|
||||
private final Map<String, List<PackResources>> namespacesData;
|
||||
private Map<String, List<PackResources>> namespacesAssets;
|
||||
private Map<String, List<PackResources>> namespacesData;
|
||||
|
||||
private final String name;
|
||||
private final PackMetadataSection packInfo;
|
||||
@@ -42,6 +42,21 @@ public class DelegatingResourcePack extends AbstractPackResources
|
||||
this.namespacesData = this.buildNamespaceMap(PackType.SERVER_DATA, delegates);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initForNamespace(final String nameSpace)
|
||||
{
|
||||
this.delegates.forEach(delegate -> delegate.initForNamespace(nameSpace));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(final PackType packType)
|
||||
{
|
||||
this.delegates.forEach(packResources -> packResources.init(packType));
|
||||
|
||||
this.namespacesAssets = buildNamespaceMap(PackType.CLIENT_RESOURCES, delegates);
|
||||
this.namespacesData = buildNamespaceMap(PackType.SERVER_DATA, delegates);
|
||||
}
|
||||
|
||||
private Map<String, List<PackResources>> buildNamespaceMap(PackType type, List<PackResources> packList)
|
||||
{
|
||||
Map<String, List<PackResources>> map = new HashMap<>();
|
||||
|
||||
Reference in new issue
Block a user