use of net.minecraftforge.fml.ModLoadingWarning in project MinecraftForge by MinecraftForge.
the class ServerLifecycleHooks method serverPackFinder.
private static void serverPackFinder(Map<IModFile, ? extends PathResourcePack> modResourcePacks, Consumer<Pack> consumer, Pack.PackConstructor factory) {
for (Entry<IModFile, ? extends PathResourcePack> e : modResourcePacks.entrySet()) {
IModInfo mod = e.getKey().getModInfos().get(0);
// skip the minecraft "mod"
if (Objects.equals(mod.getModId(), "minecraft"))
continue;
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());
consumer.accept(packInfo);
}
}
Aggregations