Search in sources :

Example 1 with ModFileResourcePack

use of net.minecraftforge.fml.packs.ModFileResourcePack in project Magma-1.16.x by magmafoundation.

the class ClientHooks method logMissingTextureErrors.

public static void logMissingTextureErrors() {
    if (missingTextures.isEmpty() && brokenTextures.isEmpty()) {
        return;
    }
    Logger logger = LogManager.getLogger("FML.TEXTURE_ERRORS");
    logger.error(Strings.repeat("+=", 25));
    logger.error("The following texture errors were found.");
    Map<String, FallbackResourceManager> resManagers = ObfuscationReflectionHelper.getPrivateValue(SimpleReloadableResourceManager.class, (SimpleReloadableResourceManager) Minecraft.getInstance().getResourceManager(), "field_199014" + "_c");
    for (String resourceDomain : badTextureDomains) {
        Set<ResourceLocation> missing = missingTextures.get(resourceDomain);
        logger.error(Strings.repeat("=", 50));
        logger.error("  DOMAIN {}", resourceDomain);
        logger.error(Strings.repeat("-", 50));
        logger.error("  domain {} is missing {} texture{}", resourceDomain, missing.size(), missing.size() != 1 ? "s" : "");
        FallbackResourceManager fallbackResourceManager = resManagers.get(resourceDomain);
        if (fallbackResourceManager == null) {
            logger.error("    domain {} is missing a resource manager - it is probably a side-effect of automatic texture processing", resourceDomain);
        } else {
            List<IResourcePack> resPacks = fallbackResourceManager.fallbacks;
            logger.error("    domain {} has {} location{}:", resourceDomain, resPacks.size(), resPacks.size() != 1 ? "s" : "");
            for (IResourcePack resPack : resPacks) {
                if (resPack instanceof ModFileResourcePack) {
                    ModFileResourcePack modRP = (ModFileResourcePack) resPack;
                    List<IModInfo> mods = modRP.getModFile().getModInfos();
                    logger.error("      mod(s) {} resources at {}", mods.stream().map(IModInfo::getDisplayName).collect(Collectors.toList()), modRP.getModFile().getFilePath());
                } else if (resPack instanceof ResourcePack) {
                    logger.error("      resource pack at path {}", ((ResourcePack) resPack).file.getPath());
                } else {
                    logger.error("      unknown resourcepack type {} : {}", resPack.getClass().getName(), resPack.getName());
                }
            }
        }
        logger.error(Strings.repeat("-", 25));
        if (missingTextures.containsKey(resourceDomain)) {
            logger.error("    The missing resources for domain {} are:", resourceDomain);
            for (ResourceLocation rl : missing) {
                logger.error("      {}", rl.getPath());
            }
            logger.error(Strings.repeat("-", 25));
        }
        if (!brokenTextures.containsRow(resourceDomain)) {
            logger.error("    No other errors exist for domain {}", resourceDomain);
        } else {
            logger.error("    The following other errors were reported for domain {}:", resourceDomain);
            Map<String, Set<ResourceLocation>> resourceErrs = brokenTextures.row(resourceDomain);
            for (String error : resourceErrs.keySet()) {
                logger.error(Strings.repeat("-", 25));
                logger.error("    Problem: {}", error);
                for (ResourceLocation rl : resourceErrs.get(error)) {
                    logger.error("      {}", rl.getPath());
                }
            }
        }
        logger.error(Strings.repeat("=", 50));
    }
    logger.error(Strings.repeat("+=", 25));
}
Also used : IModInfo(net.minecraftforge.forgespi.language.IModInfo) ResourcePack(net.minecraft.resources.ResourcePack) IResourcePack(net.minecraft.resources.IResourcePack) ModFileResourcePack(net.minecraftforge.fml.packs.ModFileResourcePack) Logger(org.apache.logging.log4j.Logger) IResourcePack(net.minecraft.resources.IResourcePack) ResourceLocation(net.minecraft.util.ResourceLocation) ModFileResourcePack(net.minecraftforge.fml.packs.ModFileResourcePack) FallbackResourceManager(net.minecraft.resources.FallbackResourceManager)

Example 2 with ModFileResourcePack

use of net.minecraftforge.fml.packs.ModFileResourcePack in project Magma-1.16.x by magmafoundation.

the class ClientModLoader method clientPackFinder.

private static void clientPackFinder(Map<ModFile, ? extends ModFileResourcePack> modResourcePacks, BiConsumer<? super ModFileResourcePack, ResourcePackInfo> packSetter, Consumer<ResourcePackInfo> consumer, ResourcePackInfo.IFactory factory) {
    List<ModFileResourcePack> hiddenPacks = new ArrayList<>();
    for (Entry<ModFile, ? extends ModFileResourcePack> 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 ResourcePackInfo packInfo = ResourcePackInfo.create(name, false, e::getValue, factory, ResourcePackInfo.Priority.BOTTOM, IPackNameDecorator.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;
        }
        packSetter.accept(e.getValue(), packInfo);
        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 ResourcePackInfo packInfo = ResourcePackInfo.create("mod_resources", true, () -> new DelegatingResourcePack("mod_resources", "Mod Resources", new PackMetadataSection(new TranslationTextComponent("fml.resources.modresources", hiddenPacks.size()), 6), hiddenPacks), factory, ResourcePackInfo.Priority.BOTTOM, IPackNameDecorator.DEFAULT);
    consumer.accept(packInfo);
}
Also used : DelegatingResourcePack(net.minecraftforge.fml.packs.DelegatingResourcePack) IModInfo(net.minecraftforge.forgespi.language.IModInfo) ModFile(net.minecraftforge.fml.loading.moddiscovery.ModFile) CompletableFuture(java.util.concurrent.CompletableFuture) File(java.io.File) MinecraftForge(net.minecraftforge.common.MinecraftForge) ResourcePackInfo(net.minecraft.resources.ResourcePackInfo) ModFile(net.minecraftforge.fml.loading.moddiscovery.ModFile) TranslationTextComponent(net.minecraft.util.text.TranslationTextComponent) ModFileResourcePack(net.minecraftforge.fml.packs.ModFileResourcePack) PackMetadataSection(net.minecraft.resources.data.PackMetadataSection)

Example 3 with ModFileResourcePack

use of net.minecraftforge.fml.packs.ModFileResourcePack in project Magma-1.16.x by magmafoundation.

the class ModListScreen method updateCache.

private void updateCache() {
    if (selected == null) {
        this.configButton.active = false;
        this.modInfo.clearInfo();
        return;
    }
    ModInfo selectedMod = selected.getInfo();
    this.configButton.active = ConfigGuiHandler.getGuiFactoryFor(selectedMod).isPresent();
    List<String> lines = new ArrayList<>();
    VersionChecker.CheckResult vercheck = VersionChecker.getResult(selectedMod);
    @SuppressWarnings("resource") Pair<ResourceLocation, Size2i> logoData = selectedMod.getLogoFile().map(logoFile -> {
        TextureManager tm = this.minecraft.getTextureManager();
        final ModFileResourcePack resourcePack = ResourcePackLoader.getResourcePackFor(selectedMod.getModId()).orElse(ResourcePackLoader.getResourcePackFor("forge").orElseThrow(() -> new RuntimeException("Can't find forge, WHAT!")));
        try {
            NativeImage logo = null;
            InputStream logoResource = resourcePack.getRootResource(logoFile);
            if (logoResource != null)
                logo = NativeImage.read(logoResource);
            if (logo != null) {
                return Pair.of(tm.register("modlogo", new DynamicTexture(logo) {

                    @Override
                    public void upload() {
                        this.bind();
                        NativeImage td = this.getPixels();
                        // Use custom "blur" value which controls texture filtering (nearest-neighbor vs linear)
                        this.getPixels().upload(0, 0, 0, 0, 0, td.getWidth(), td.getHeight(), selectedMod.getLogoBlur(), false, false, false);
                    }
                }), new Size2i(logo.getWidth(), logo.getHeight()));
            }
        } catch (IOException e) {
        }
        return Pair.<ResourceLocation, Size2i>of(null, new Size2i(0, 0));
    }).orElse(Pair.of(null, new Size2i(0, 0)));
    lines.add(selectedMod.getDisplayName());
    lines.add(ForgeI18n.parseMessage("fml.menu.mods.info.version", MavenVersionStringHelper.artifactVersionToString(selectedMod.getVersion())));
    lines.add(ForgeI18n.parseMessage("fml.menu.mods.info.idstate", selectedMod.getModId(), ModList.get().getModContainerById(selectedMod.getModId()).map(ModContainer::getCurrentState).map(Object::toString).orElse("NONE")));
    selectedMod.getConfigElement("credits").ifPresent(credits -> lines.add(ForgeI18n.parseMessage("fml.menu.mods.info.credits", credits)));
    selectedMod.getConfigElement("authors").ifPresent(authors -> lines.add(ForgeI18n.parseMessage("fml.menu.mods.info.authors", authors)));
    selectedMod.getConfigElement("displayURL").ifPresent(displayURL -> lines.add(ForgeI18n.parseMessage("fml.menu.mods.info.displayurl", displayURL)));
    if (selectedMod.getOwningFile() == null || selectedMod.getOwningFile().getMods().size() == 1)
        lines.add(ForgeI18n.parseMessage("fml.menu.mods.info.nochildmods"));
    else
        lines.add(ForgeI18n.parseMessage("fml.menu.mods.info.childmods", selectedMod.getOwningFile().getMods().stream().map(IModInfo::getDisplayName).collect(Collectors.joining(","))));
    if (vercheck.status == VersionChecker.Status.OUTDATED || vercheck.status == VersionChecker.Status.BETA_OUTDATED)
        lines.add(ForgeI18n.parseMessage("fml.menu.mods.info.updateavailable", vercheck.url == null ? "" : vercheck.url));
    lines.add(ForgeI18n.parseMessage("fml.menu.mods.info.license", selectedMod.getOwningFile().getLicense()));
    lines.add(null);
    lines.add(selectedMod.getDescription());
    if ((vercheck.status == VersionChecker.Status.OUTDATED || vercheck.status == VersionChecker.Status.BETA_OUTDATED) && vercheck.changes.size() > 0) {
        lines.add(null);
        lines.add(ForgeI18n.parseMessage("fml.menu.mods.info.changelogheader"));
        for (Entry<ComparableVersion, String> entry : vercheck.changes.entrySet()) {
            lines.add("  " + entry.getKey() + ":");
            lines.add(entry.getValue());
            lines.add(null);
        }
    }
    modInfo.setInfo(lines, logoData.getLeft(), logoData.getRight());
}
Also used : NativeImage(net.minecraft.client.renderer.texture.NativeImage) Pair(org.apache.commons.lang3.tuple.Pair) Button(net.minecraft.client.gui.widget.button.Button) ComparableVersion(org.apache.maven.artifact.versioning.ComparableVersion) ResourcePackLoader(net.minecraftforge.fml.packs.ResourcePackLoader) FMLPaths(net.minecraftforge.fml.loading.FMLPaths) ConfigGuiHandler(net.minecraftforge.fml.client.ConfigGuiHandler) ModList(net.minecraftforge.fml.ModList) IModInfo(net.minecraftforge.forgespi.language.IModInfo) Collectors(java.util.stream.Collectors) List(java.util.List) Logger(org.apache.logging.log4j.Logger) Screen(net.minecraft.client.gui.screen.Screen) ScrollPanel(net.minecraftforge.client.gui.ScrollPanel) Environment(cpw.mods.modlauncher.Environment) FMLEnvironment(net.minecraftforge.fml.loading.FMLEnvironment) Entry(java.util.Map.Entry) ModFileResourcePack(net.minecraftforge.fml.packs.ModFileResourcePack) Size2i(net.minecraftforge.common.util.Size2i) net.minecraft.util.text(net.minecraft.util.text) DynamicTexture(net.minecraft.client.renderer.texture.DynamicTexture) ForgeHooks(net.minecraftforge.common.ForgeHooks) ModContainer(net.minecraftforge.fml.ModContainer) Util(net.minecraft.util.Util) ForgeI18n(net.minecraftforge.fml.ForgeI18n) IReorderingProcessor(net.minecraft.util.IReorderingProcessor) Function(java.util.function.Function) ArrayList(java.util.ArrayList) ModInfo(net.minecraftforge.fml.loading.moddiscovery.ModInfo) Minecraft(net.minecraft.client.Minecraft) TextFieldWidget(net.minecraft.client.gui.widget.TextFieldWidget) MatrixStack(com.mojang.blaze3d.matrix.MatrixStack) MavenVersionStringHelper(net.minecraftforge.fml.MavenVersionStringHelper) ModListWidget(net.minecraftforge.fml.client.gui.widget.ModListWidget) StringUtils(net.minecraftforge.fml.loading.StringUtils) GuiUtils(net.minecraftforge.fml.client.gui.GuiUtils) ExtendedList(net.minecraft.client.gui.widget.list.ExtendedList) IOException(java.io.IOException) TextureManager(net.minecraft.client.renderer.texture.TextureManager) Consumer(java.util.function.Consumer) VersionChecker(net.minecraftforge.fml.VersionChecker) FontRenderer(net.minecraft.client.gui.FontRenderer) Tessellator(net.minecraft.client.renderer.Tessellator) RenderSystem(com.mojang.blaze3d.systems.RenderSystem) ResourceLocation(net.minecraft.util.ResourceLocation) Comparator(java.util.Comparator) Collections(java.util.Collections) LogManager(org.apache.logging.log4j.LogManager) InputStream(java.io.InputStream) ModContainer(net.minecraftforge.fml.ModContainer) IModInfo(net.minecraftforge.forgespi.language.IModInfo) InputStream(java.io.InputStream) ArrayList(java.util.ArrayList) DynamicTexture(net.minecraft.client.renderer.texture.DynamicTexture) IOException(java.io.IOException) ComparableVersion(org.apache.maven.artifact.versioning.ComparableVersion) VersionChecker(net.minecraftforge.fml.VersionChecker) TextureManager(net.minecraft.client.renderer.texture.TextureManager) NativeImage(net.minecraft.client.renderer.texture.NativeImage) ResourceLocation(net.minecraft.util.ResourceLocation) Size2i(net.minecraftforge.common.util.Size2i) ModFileResourcePack(net.minecraftforge.fml.packs.ModFileResourcePack) IModInfo(net.minecraftforge.forgespi.language.IModInfo) ModInfo(net.minecraftforge.fml.loading.moddiscovery.ModInfo)

Example 4 with ModFileResourcePack

use of net.minecraftforge.fml.packs.ModFileResourcePack in project LoliServer by Loli-Server.

the class ModListScreen method updateCache.

private void updateCache() {
    if (selected == null) {
        this.configButton.active = false;
        this.modInfo.clearInfo();
        return;
    }
    ModInfo selectedMod = selected.getInfo();
    this.configButton.active = ConfigGuiHandler.getGuiFactoryFor(selectedMod).isPresent();
    List<String> lines = new ArrayList<>();
    VersionChecker.CheckResult vercheck = VersionChecker.getResult(selectedMod);
    @SuppressWarnings("resource") Pair<ResourceLocation, Size2i> logoData = selectedMod.getLogoFile().map(logoFile -> {
        TextureManager tm = this.minecraft.getTextureManager();
        final ModFileResourcePack resourcePack = ResourcePackLoader.getResourcePackFor(selectedMod.getModId()).orElse(ResourcePackLoader.getResourcePackFor("forge").orElseThrow(() -> new RuntimeException("Can't find forge, WHAT!")));
        try {
            NativeImage logo = null;
            InputStream logoResource = resourcePack.getRootResource(logoFile);
            if (logoResource != null)
                logo = NativeImage.read(logoResource);
            if (logo != null) {
                return Pair.of(tm.register("modlogo", new DynamicTexture(logo) {

                    @Override
                    public void upload() {
                        this.bind();
                        NativeImage td = this.getPixels();
                        // Use custom "blur" value which controls texture filtering (nearest-neighbor vs linear)
                        this.getPixels().upload(0, 0, 0, 0, 0, td.getWidth(), td.getHeight(), selectedMod.getLogoBlur(), false, false, false);
                    }
                }), new Size2i(logo.getWidth(), logo.getHeight()));
            }
        } catch (IOException e) {
        }
        return Pair.<ResourceLocation, Size2i>of(null, new Size2i(0, 0));
    }).orElse(Pair.of(null, new Size2i(0, 0)));
    lines.add(selectedMod.getDisplayName());
    lines.add(ForgeI18n.parseMessage("fml.menu.mods.info.version", MavenVersionStringHelper.artifactVersionToString(selectedMod.getVersion())));
    lines.add(ForgeI18n.parseMessage("fml.menu.mods.info.idstate", selectedMod.getModId(), ModList.get().getModContainerById(selectedMod.getModId()).map(ModContainer::getCurrentState).map(Object::toString).orElse("NONE")));
    selectedMod.getConfigElement("credits").ifPresent(credits -> lines.add(ForgeI18n.parseMessage("fml.menu.mods.info.credits", credits)));
    selectedMod.getConfigElement("authors").ifPresent(authors -> lines.add(ForgeI18n.parseMessage("fml.menu.mods.info.authors", authors)));
    selectedMod.getConfigElement("displayURL").ifPresent(displayURL -> lines.add(ForgeI18n.parseMessage("fml.menu.mods.info.displayurl", displayURL)));
    if (selectedMod.getOwningFile() == null || selectedMod.getOwningFile().getMods().size() == 1)
        lines.add(ForgeI18n.parseMessage("fml.menu.mods.info.nochildmods"));
    else
        lines.add(ForgeI18n.parseMessage("fml.menu.mods.info.childmods", selectedMod.getOwningFile().getMods().stream().map(IModInfo::getDisplayName).collect(Collectors.joining(","))));
    if (vercheck.status == VersionChecker.Status.OUTDATED || vercheck.status == VersionChecker.Status.BETA_OUTDATED)
        lines.add(ForgeI18n.parseMessage("fml.menu.mods.info.updateavailable", vercheck.url == null ? "" : vercheck.url));
    lines.add(ForgeI18n.parseMessage("fml.menu.mods.info.license", selectedMod.getOwningFile().getLicense()));
    lines.add(null);
    lines.add(selectedMod.getDescription());
    if ((vercheck.status == VersionChecker.Status.OUTDATED || vercheck.status == VersionChecker.Status.BETA_OUTDATED) && vercheck.changes.size() > 0) {
        lines.add(null);
        lines.add(ForgeI18n.parseMessage("fml.menu.mods.info.changelogheader"));
        for (Entry<ComparableVersion, String> entry : vercheck.changes.entrySet()) {
            lines.add("  " + entry.getKey() + ":");
            lines.add(entry.getValue());
            lines.add(null);
        }
    }
    modInfo.setInfo(lines, logoData.getLeft(), logoData.getRight());
}
Also used : NativeImage(net.minecraft.client.renderer.texture.NativeImage) Pair(org.apache.commons.lang3.tuple.Pair) Button(net.minecraft.client.gui.widget.button.Button) ComparableVersion(org.apache.maven.artifact.versioning.ComparableVersion) ResourcePackLoader(net.minecraftforge.fml.packs.ResourcePackLoader) FMLPaths(net.minecraftforge.fml.loading.FMLPaths) ConfigGuiHandler(net.minecraftforge.fml.client.ConfigGuiHandler) ModList(net.minecraftforge.fml.ModList) IModInfo(net.minecraftforge.forgespi.language.IModInfo) Collectors(java.util.stream.Collectors) List(java.util.List) Logger(org.apache.logging.log4j.Logger) Screen(net.minecraft.client.gui.screen.Screen) ScrollPanel(net.minecraftforge.client.gui.ScrollPanel) Environment(cpw.mods.modlauncher.Environment) FMLEnvironment(net.minecraftforge.fml.loading.FMLEnvironment) Entry(java.util.Map.Entry) ModFileResourcePack(net.minecraftforge.fml.packs.ModFileResourcePack) Size2i(net.minecraftforge.common.util.Size2i) net.minecraft.util.text(net.minecraft.util.text) DynamicTexture(net.minecraft.client.renderer.texture.DynamicTexture) ForgeHooks(net.minecraftforge.common.ForgeHooks) ModContainer(net.minecraftforge.fml.ModContainer) Util(net.minecraft.util.Util) ForgeI18n(net.minecraftforge.fml.ForgeI18n) IReorderingProcessor(net.minecraft.util.IReorderingProcessor) Function(java.util.function.Function) ArrayList(java.util.ArrayList) ModInfo(net.minecraftforge.fml.loading.moddiscovery.ModInfo) Minecraft(net.minecraft.client.Minecraft) TextFieldWidget(net.minecraft.client.gui.widget.TextFieldWidget) MatrixStack(com.mojang.blaze3d.matrix.MatrixStack) MavenVersionStringHelper(net.minecraftforge.fml.MavenVersionStringHelper) ModListWidget(net.minecraftforge.fml.client.gui.widget.ModListWidget) StringUtils(net.minecraftforge.fml.loading.StringUtils) GuiUtils(net.minecraftforge.fml.client.gui.GuiUtils) ExtendedList(net.minecraft.client.gui.widget.list.ExtendedList) IOException(java.io.IOException) TextureManager(net.minecraft.client.renderer.texture.TextureManager) Consumer(java.util.function.Consumer) VersionChecker(net.minecraftforge.fml.VersionChecker) FontRenderer(net.minecraft.client.gui.FontRenderer) Tessellator(net.minecraft.client.renderer.Tessellator) RenderSystem(com.mojang.blaze3d.systems.RenderSystem) ResourceLocation(net.minecraft.util.ResourceLocation) Comparator(java.util.Comparator) Collections(java.util.Collections) LogManager(org.apache.logging.log4j.LogManager) InputStream(java.io.InputStream) ModContainer(net.minecraftforge.fml.ModContainer) IModInfo(net.minecraftforge.forgespi.language.IModInfo) InputStream(java.io.InputStream) ArrayList(java.util.ArrayList) DynamicTexture(net.minecraft.client.renderer.texture.DynamicTexture) IOException(java.io.IOException) ComparableVersion(org.apache.maven.artifact.versioning.ComparableVersion) VersionChecker(net.minecraftforge.fml.VersionChecker) TextureManager(net.minecraft.client.renderer.texture.TextureManager) NativeImage(net.minecraft.client.renderer.texture.NativeImage) ResourceLocation(net.minecraft.util.ResourceLocation) Size2i(net.minecraftforge.common.util.Size2i) ModFileResourcePack(net.minecraftforge.fml.packs.ModFileResourcePack) IModInfo(net.minecraftforge.forgespi.language.IModInfo) ModInfo(net.minecraftforge.fml.loading.moddiscovery.ModInfo)

Example 5 with ModFileResourcePack

use of net.minecraftforge.fml.packs.ModFileResourcePack in project LoliServer by Loli-Server.

the class ClientModLoader method clientPackFinder.

private static void clientPackFinder(Map<ModFile, ? extends ModFileResourcePack> modResourcePacks, BiConsumer<? super ModFileResourcePack, ResourcePackInfo> packSetter, Consumer<ResourcePackInfo> consumer, ResourcePackInfo.IFactory factory) {
    List<ModFileResourcePack> hiddenPacks = new ArrayList<>();
    for (Entry<ModFile, ? extends ModFileResourcePack> 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 ResourcePackInfo packInfo = ResourcePackInfo.create(name, false, e::getValue, factory, ResourcePackInfo.Priority.BOTTOM, IPackNameDecorator.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;
        }
        packSetter.accept(e.getValue(), packInfo);
        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 ResourcePackInfo packInfo = ResourcePackInfo.create("mod_resources", true, () -> new DelegatingResourcePack("mod_resources", "Mod Resources", new PackMetadataSection(new TranslationTextComponent("fml.resources.modresources", hiddenPacks.size()), 6), hiddenPacks), factory, ResourcePackInfo.Priority.BOTTOM, IPackNameDecorator.DEFAULT);
    consumer.accept(packInfo);
}
Also used : DelegatingResourcePack(net.minecraftforge.fml.packs.DelegatingResourcePack) IModInfo(net.minecraftforge.forgespi.language.IModInfo) ModFile(net.minecraftforge.fml.loading.moddiscovery.ModFile) CompletableFuture(java.util.concurrent.CompletableFuture) File(java.io.File) MinecraftForge(net.minecraftforge.common.MinecraftForge) ResourcePackInfo(net.minecraft.resources.ResourcePackInfo) ModFile(net.minecraftforge.fml.loading.moddiscovery.ModFile) TranslationTextComponent(net.minecraft.util.text.TranslationTextComponent) ModFileResourcePack(net.minecraftforge.fml.packs.ModFileResourcePack) PackMetadataSection(net.minecraft.resources.data.PackMetadataSection)

Aggregations

ModFileResourcePack (net.minecraftforge.fml.packs.ModFileResourcePack)6 IModInfo (net.minecraftforge.forgespi.language.IModInfo)6 ResourceLocation (net.minecraft.util.ResourceLocation)4 Logger (org.apache.logging.log4j.Logger)4 MatrixStack (com.mojang.blaze3d.matrix.MatrixStack)2 RenderSystem (com.mojang.blaze3d.systems.RenderSystem)2 Environment (cpw.mods.modlauncher.Environment)2 File (java.io.File)2 IOException (java.io.IOException)2 InputStream (java.io.InputStream)2 ArrayList (java.util.ArrayList)2 Collections (java.util.Collections)2 Comparator (java.util.Comparator)2 List (java.util.List)2 Entry (java.util.Map.Entry)2 CompletableFuture (java.util.concurrent.CompletableFuture)2 Consumer (java.util.function.Consumer)2 Function (java.util.function.Function)2 Collectors (java.util.stream.Collectors)2 Minecraft (net.minecraft.client.Minecraft)2