From c7622c06d76a54db0a708f101bfe28646dcfad1b Mon Sep 17 00:00:00 2001 From: cpw Date: Sat, 11 Apr 2015 00:31:09 -0400 Subject: [PATCH] Cleaning up the missing resource stack spam, and condensing the information into a usefully understandable format. --- .../renderer/texture/TextureMap.java.patch | 12 ++++ .../cpw/mods/fml/client/FMLClientHandler.java | 68 +++++++++++++++++++ .../mods/fml/client/FMLFileResourcePack.java | 11 ++- .../fml/client/FMLFolderResourcePack.java | 11 ++- .../mods/fml/common/FMLContainerHolder.java | 6 ++ 5 files changed, 106 insertions(+), 2 deletions(-) create mode 100644 fml/patches/minecraft/net/minecraft/client/renderer/texture/TextureMap.java.patch create mode 100644 fml/src/main/java/cpw/mods/fml/common/FMLContainerHolder.java diff --git a/fml/patches/minecraft/net/minecraft/client/renderer/texture/TextureMap.java.patch b/fml/patches/minecraft/net/minecraft/client/renderer/texture/TextureMap.java.patch new file mode 100644 index 000000000..d87d49049 --- /dev/null +++ b/fml/patches/minecraft/net/minecraft/client/renderer/texture/TextureMap.java.patch @@ -0,0 +1,12 @@ +--- ../src-base/minecraft/net/minecraft/client/renderer/texture/TextureMap.java ++++ ../src-work/minecraft/net/minecraft/client/renderer/texture/TextureMap.java +@@ -161,7 +161,8 @@ + } + catch (IOException ioexception1) + { +- field_147635_d.error("Using missing texture, unable to load " + resourcelocation1, ioexception1); ++// logger.error("Using missing texture, unable to load " + resourcelocation1, ioexception1); ++ cpw.mods.fml.client.FMLClientHandler.instance().trackMissingTexture(resourcelocation1); + continue; + } + diff --git a/fml/src/main/java/cpw/mods/fml/client/FMLClientHandler.java b/fml/src/main/java/cpw/mods/fml/client/FMLClientHandler.java index cab9210ca..6a95b7319 100644 --- a/fml/src/main/java/cpw/mods/fml/client/FMLClientHandler.java +++ b/fml/src/main/java/cpw/mods/fml/client/FMLClientHandler.java @@ -41,8 +41,11 @@ import net.minecraft.client.network.NetHandlerPlayClient; import net.minecraft.client.network.OldServerPinger; import net.minecraft.client.renderer.entity.Render; import net.minecraft.client.renderer.entity.RenderManager; +import net.minecraft.client.resources.AbstractResourcePack; +import net.minecraft.client.resources.FallbackResourceManager; import net.minecraft.client.resources.IReloadableResourceManager; import net.minecraft.client.resources.IResourcePack; +import net.minecraft.client.resources.SimpleReloadableResourceManager; import net.minecraft.crash.CrashReport; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; @@ -59,14 +62,18 @@ import net.minecraft.world.WorldSettings; import net.minecraft.world.storage.SaveFormatOld; import org.apache.logging.log4j.Level; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import org.lwjgl.input.Mouse; import com.google.common.base.Strings; import com.google.common.base.Throwables; import com.google.common.collect.BiMap; import com.google.common.collect.HashBiMap; +import com.google.common.collect.HashMultimap; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; +import com.google.common.collect.SetMultimap; import com.google.common.collect.ImmutableMap.Builder; import com.google.common.collect.Maps; import com.google.gson.JsonArray; @@ -77,6 +84,7 @@ import cpw.mods.fml.client.registry.RenderingRegistry; import cpw.mods.fml.common.DummyModContainer; import cpw.mods.fml.common.DuplicateModsFoundException; import cpw.mods.fml.common.FMLCommonHandler; +import cpw.mods.fml.common.FMLContainerHolder; import cpw.mods.fml.common.FMLLog; import cpw.mods.fml.common.IFMLSidedHandler; import cpw.mods.fml.common.Loader; @@ -378,6 +386,7 @@ public class FMLClientHandler implements IFMLSidedHandler else { } + logMissingTextureErrors(); } /** * Get the server instance @@ -875,4 +884,63 @@ public class FMLClientHandler implements IFMLSidedHandler public void allowLogins() { // NOOP for integrated server } + + + private static SetMultimap missingTextures = HashMultimap.create(); + public void trackMissingTexture(ResourceLocation resourceLocation) + { + missingTextures.put(resourceLocation.getResourceDomain(),resourceLocation); + } + + public void logMissingTextureErrors() + { + Logger logger = LogManager.getLogger("TEXTURE ERRORS"); + logger.error(Strings.repeat("+=", 25)); + logger.error("The following missing textures were found."); + Map resManagers = ObfuscationReflectionHelper.getPrivateValue(SimpleReloadableResourceManager.class, (SimpleReloadableResourceManager)Minecraft.getMinecraft().getResourceManager(), "domainResourceManagers", "field_110548"+"_a"); + for (String resourceDomain : missingTextures.keySet()) + { + Set missing = missingTextures.get(resourceDomain); + logger.error(" DOMAIN {}", resourceDomain); + logger.error(" domain {} is missing {} texture{}",resourceDomain, missing.size(),missing.size()!=1 ? "s" : ""); + logger.error(Strings.repeat("=", 50)); + FallbackResourceManager fallbackResourceManager = resManagers.get(resourceDomain); + if (fallbackResourceManager == null) + { + logger.error(" domain {} is missing a resource manager, how very odd"); + } + else + { + List 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)); + logger.error(" The missing resources for domain {} are:",resourceDomain); + for (ResourceLocation rl : missing) + { + logger.error(" {}",rl.getResourcePath()); + } + logger.error(Strings.repeat("-", 50)); + } + logger.error(Strings.repeat("+=", 25)); + } + } diff --git a/fml/src/main/java/cpw/mods/fml/client/FMLFileResourcePack.java b/fml/src/main/java/cpw/mods/fml/client/FMLFileResourcePack.java index 50ad1b144..89fb40dad 100644 --- a/fml/src/main/java/cpw/mods/fml/client/FMLFileResourcePack.java +++ b/fml/src/main/java/cpw/mods/fml/client/FMLFileResourcePack.java @@ -4,6 +4,7 @@ import java.awt.image.BufferedImage; import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; + import org.apache.logging.log4j.Level; import javax.imageio.ImageIO; @@ -12,10 +13,12 @@ import net.minecraft.client.resources.FileResourcePack; import com.google.common.base.Charsets; +import cpw.mods.fml.common.FMLContainerHolder; import cpw.mods.fml.common.FMLLog; +import cpw.mods.fml.common.FMLModContainer; import cpw.mods.fml.common.ModContainer; -public class FMLFileResourcePack extends FileResourcePack { +public class FMLFileResourcePack extends FileResourcePack implements FMLContainerHolder { private ModContainer container; @@ -58,4 +61,10 @@ public class FMLFileResourcePack extends FileResourcePack { { return ImageIO.read(getInputStreamByName(container.getMetadata().logoFile)); } + + @Override + public ModContainer getFMLContainer() + { + return container; + } } diff --git a/fml/src/main/java/cpw/mods/fml/client/FMLFolderResourcePack.java b/fml/src/main/java/cpw/mods/fml/client/FMLFolderResourcePack.java index cdb7fcac7..9edd66237 100644 --- a/fml/src/main/java/cpw/mods/fml/client/FMLFolderResourcePack.java +++ b/fml/src/main/java/cpw/mods/fml/client/FMLFolderResourcePack.java @@ -4,6 +4,7 @@ import java.awt.image.BufferedImage; import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; + import org.apache.logging.log4j.Level; import javax.imageio.ImageIO; @@ -12,10 +13,12 @@ import net.minecraft.client.resources.FolderResourcePack; import com.google.common.base.Charsets; +import cpw.mods.fml.common.FMLContainerHolder; import cpw.mods.fml.common.FMLLog; +import cpw.mods.fml.common.FMLModContainer; import cpw.mods.fml.common.ModContainer; -public class FMLFolderResourcePack extends FolderResourcePack { +public class FMLFolderResourcePack extends FolderResourcePack implements FMLContainerHolder { private ModContainer container; @@ -64,4 +67,10 @@ public class FMLFolderResourcePack extends FolderResourcePack { return ImageIO.read(getInputStreamByName(container.getMetadata().logoFile)); } + @Override + public ModContainer getFMLContainer() + { + return container; + } + } diff --git a/fml/src/main/java/cpw/mods/fml/common/FMLContainerHolder.java b/fml/src/main/java/cpw/mods/fml/common/FMLContainerHolder.java new file mode 100644 index 000000000..f4f424155 --- /dev/null +++ b/fml/src/main/java/cpw/mods/fml/common/FMLContainerHolder.java @@ -0,0 +1,6 @@ +package cpw.mods.fml.common; + +public interface FMLContainerHolder +{ + ModContainer getFMLContainer(); +}