Search in sources :

Example 1 with FallbackResourceManager

use of net.minecraft.client.resources.FallbackResourceManager in project MinecraftForge by MinecraftForge.

the class FMLClientHandler method logMissingTextureErrors.

public void logMissingTextureErrors() {
    if (missingTextures.isEmpty() && brokenTextures.isEmpty()) {
        return;
    }
    Logger logger = LogManager.getLogger("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.getMinecraft().getResourceManager(), "domainResourceManagers", "field_110548" + "_a");
    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 = ObfuscationReflectionHelper.getPrivateValue(FallbackResourceManager.class, fallbackResourceManager, "resourcePacks", "field_110540" + "_a");
            logger.error("    domain {} has {} location{}:", resourceDomain, resPacks.size(), resPacks.size() != 1 ? "s" : "");
            for (IResourcePack resPack : resPacks) {
                if (resPack instanceof FMLContainerHolder) {
                    FMLContainerHolder containerHolder = (FMLContainerHolder) resPack;
                    ModContainer fmlContainer = containerHolder.getFMLContainer();
                    logger.error("      mod {} resources at {}", fmlContainer.getModId(), fmlContainer.getSource().getPath());
                } else if (resPack instanceof AbstractResourcePack) {
                    AbstractResourcePack resourcePack = (AbstractResourcePack) resPack;
                    File resPath = ObfuscationReflectionHelper.getPrivateValue(AbstractResourcePack.class, resourcePack, "resourcePackFile", "field_110597" + "_b");
                    logger.error("      resource pack at path {}", resPath.getPath());
                } else {
                    logger.error("      unknown resourcepack type {} : {}", resPack.getClass().getName(), resPack.getPackName());
                }
            }
        }
        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.getResourcePath());
            }
            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.getResourcePath());
                }
            }
        }
        logger.error(Strings.repeat("=", 50));
    }
    logger.error(Strings.repeat("+=", 25));
}
Also used : Set(java.util.Set) ForgeModContainer(net.minecraftforge.common.ForgeModContainer) ModContainer(net.minecraftforge.fml.common.ModContainer) DummyModContainer(net.minecraftforge.fml.common.DummyModContainer) AbstractResourcePack(net.minecraft.client.resources.AbstractResourcePack) Logger(org.apache.logging.log4j.Logger) FMLContainerHolder(net.minecraftforge.fml.common.FMLContainerHolder) IResourcePack(net.minecraft.client.resources.IResourcePack) ResourceLocation(net.minecraft.util.ResourceLocation) FallbackResourceManager(net.minecraft.client.resources.FallbackResourceManager) File(java.io.File)

Aggregations

File (java.io.File)1 Set (java.util.Set)1 AbstractResourcePack (net.minecraft.client.resources.AbstractResourcePack)1 FallbackResourceManager (net.minecraft.client.resources.FallbackResourceManager)1 IResourcePack (net.minecraft.client.resources.IResourcePack)1 ResourceLocation (net.minecraft.util.ResourceLocation)1 ForgeModContainer (net.minecraftforge.common.ForgeModContainer)1 DummyModContainer (net.minecraftforge.fml.common.DummyModContainer)1 FMLContainerHolder (net.minecraftforge.fml.common.FMLContainerHolder)1 ModContainer (net.minecraftforge.fml.common.ModContainer)1 Logger (org.apache.logging.log4j.Logger)1