use of net.minecraft.server.packs.metadata.pack.PackMetadataSection in project MinecraftForge by MinecraftForge.
the class ClientModLoader method clientPackFinder.
private static void clientPackFinder(Map<IModFile, ? extends PathResourcePack> modResourcePacks, Consumer<Pack> consumer, Pack.PackConstructor factory) {
List<PathResourcePack> hiddenPacks = new ArrayList<>();
for (Entry<IModFile, ? extends PathResourcePack> e : modResourcePacks.entrySet()) {
IModInfo mod = e.getKey().getModInfos().get(0);
final String name = "mod:" + mod.getModId();
final Pack packInfo = Pack.create(name, false, e::getValue, factory, Pack.Position.BOTTOM, PackSource.DEFAULT);
if (packInfo == null) {
// Vanilla only logs an error, instead of propagating, so handle null and warn that something went wrong
ModLoader.get().addWarning(new ModLoadingWarning(mod, ModLoadingStage.ERROR, "fml.modloading.brokenresources", e.getKey()));
continue;
}
LOGGER.debug(CORE, "Generating PackInfo named {} for mod file {}", name, e.getKey().getFilePath());
if (mod.getOwningFile().showAsResourcePack()) {
consumer.accept(packInfo);
} else {
hiddenPacks.add(e.getValue());
}
}
final Pack packInfo = Pack.create("mod_resources", true, () -> new DelegatingResourcePack("mod_resources", "Mod Resources", new PackMetadataSection(new TranslatableComponent("fml.resources.modresources", hiddenPacks.size()), PackType.CLIENT_RESOURCES.getVersion(SharedConstants.getCurrentVersion())), hiddenPacks), factory, Pack.Position.BOTTOM, PackSource.DEFAULT);
consumer.accept(packInfo);
}
Aggregations