Search in sources :

Example 1 with PackResources

use of net.minecraft.server.packs.PackResources in project MinecraftForge by MinecraftForge.

the class DelegatingResourcePack method buildNamespaceMap.

private Map<String, List<PackResources>> buildNamespaceMap(PackType type, List<PackResources> packList) {
    Map<String, List<PackResources>> map = new HashMap<>();
    for (PackResources pack : packList) {
        for (String namespace : pack.getNamespaces(type)) {
            map.computeIfAbsent(namespace, k -> new ArrayList<>()).add(pack);
        }
    }
    map.replaceAll((k, list) -> ImmutableList.copyOf(list));
    return ImmutableMap.copyOf(map);
}
Also used : ResourceLocation(net.minecraft.resources.ResourceLocation) AbstractPackResources(net.minecraft.server.packs.AbstractPackResources) ResourcePackFileNotFoundException(net.minecraft.server.packs.ResourcePackFileNotFoundException) java.util(java.util) ImmutableMap(com.google.common.collect.ImmutableMap) Predicate(java.util.function.Predicate) IOException(java.io.IOException) MetadataSectionSerializer(net.minecraft.server.packs.metadata.MetadataSectionSerializer) PackType(net.minecraft.server.packs.PackType) Collectors(java.util.stream.Collectors) File(java.io.File) PackMetadataSection(net.minecraft.server.packs.metadata.pack.PackMetadataSection) ImmutableList(com.google.common.collect.ImmutableList) PackResources(net.minecraft.server.packs.PackResources) InputStream(java.io.InputStream) ImmutableList(com.google.common.collect.ImmutableList) AbstractPackResources(net.minecraft.server.packs.AbstractPackResources) PackResources(net.minecraft.server.packs.PackResources)

Aggregations

ImmutableList (com.google.common.collect.ImmutableList)1 ImmutableMap (com.google.common.collect.ImmutableMap)1 File (java.io.File)1 IOException (java.io.IOException)1 InputStream (java.io.InputStream)1 java.util (java.util)1 Predicate (java.util.function.Predicate)1 Collectors (java.util.stream.Collectors)1 ResourceLocation (net.minecraft.resources.ResourceLocation)1 AbstractPackResources (net.minecraft.server.packs.AbstractPackResources)1 PackResources (net.minecraft.server.packs.PackResources)1 PackType (net.minecraft.server.packs.PackType)1 ResourcePackFileNotFoundException (net.minecraft.server.packs.ResourcePackFileNotFoundException)1 MetadataSectionSerializer (net.minecraft.server.packs.metadata.MetadataSectionSerializer)1 PackMetadataSection (net.minecraft.server.packs.metadata.pack.PackMetadataSection)1