Cleaning up the missing resource stack spam, and condensing the information into a usefully understandable

format.
This commit is contained in:
cpw 2015-04-11 00:31:09 -04:00
parent 994f722843
commit c7622c06d7
5 changed files with 106 additions and 2 deletions

View file

@ -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;
}

View file

@ -41,8 +41,11 @@ import net.minecraft.client.network.NetHandlerPlayClient;
import net.minecraft.client.network.OldServerPinger; import net.minecraft.client.network.OldServerPinger;
import net.minecraft.client.renderer.entity.Render; import net.minecraft.client.renderer.entity.Render;
import net.minecraft.client.renderer.entity.RenderManager; 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.IReloadableResourceManager;
import net.minecraft.client.resources.IResourcePack; import net.minecraft.client.resources.IResourcePack;
import net.minecraft.client.resources.SimpleReloadableResourceManager;
import net.minecraft.crash.CrashReport; import net.minecraft.crash.CrashReport;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
@ -59,14 +62,18 @@ import net.minecraft.world.WorldSettings;
import net.minecraft.world.storage.SaveFormatOld; import net.minecraft.world.storage.SaveFormatOld;
import org.apache.logging.log4j.Level; import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.lwjgl.input.Mouse; import org.lwjgl.input.Mouse;
import com.google.common.base.Strings; import com.google.common.base.Strings;
import com.google.common.base.Throwables; import com.google.common.base.Throwables;
import com.google.common.collect.BiMap; import com.google.common.collect.BiMap;
import com.google.common.collect.HashBiMap; import com.google.common.collect.HashBiMap;
import com.google.common.collect.HashMultimap;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableMap;
import com.google.common.collect.SetMultimap;
import com.google.common.collect.ImmutableMap.Builder; import com.google.common.collect.ImmutableMap.Builder;
import com.google.common.collect.Maps; import com.google.common.collect.Maps;
import com.google.gson.JsonArray; 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.DummyModContainer;
import cpw.mods.fml.common.DuplicateModsFoundException; import cpw.mods.fml.common.DuplicateModsFoundException;
import cpw.mods.fml.common.FMLCommonHandler; import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.FMLContainerHolder;
import cpw.mods.fml.common.FMLLog; import cpw.mods.fml.common.FMLLog;
import cpw.mods.fml.common.IFMLSidedHandler; import cpw.mods.fml.common.IFMLSidedHandler;
import cpw.mods.fml.common.Loader; import cpw.mods.fml.common.Loader;
@ -378,6 +386,7 @@ public class FMLClientHandler implements IFMLSidedHandler
else else
{ {
} }
logMissingTextureErrors();
} }
/** /**
* Get the server instance * Get the server instance
@ -875,4 +884,63 @@ public class FMLClientHandler implements IFMLSidedHandler
public void allowLogins() { public void allowLogins() {
// NOOP for integrated server // NOOP for integrated server
} }
private static SetMultimap<String,ResourceLocation> 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<String,FallbackResourceManager> resManagers = ObfuscationReflectionHelper.getPrivateValue(SimpleReloadableResourceManager.class, (SimpleReloadableResourceManager)Minecraft.getMinecraft().getResourceManager(), "domainResourceManagers", "field_110548"+"_a");
for (String resourceDomain : missingTextures.keySet())
{
Set<ResourceLocation> 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<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));
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));
}
} }

View file

@ -4,6 +4,7 @@ import java.awt.image.BufferedImage;
import java.io.ByteArrayInputStream; import java.io.ByteArrayInputStream;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import org.apache.logging.log4j.Level; import org.apache.logging.log4j.Level;
import javax.imageio.ImageIO; import javax.imageio.ImageIO;
@ -12,10 +13,12 @@ import net.minecraft.client.resources.FileResourcePack;
import com.google.common.base.Charsets; import com.google.common.base.Charsets;
import cpw.mods.fml.common.FMLContainerHolder;
import cpw.mods.fml.common.FMLLog; import cpw.mods.fml.common.FMLLog;
import cpw.mods.fml.common.FMLModContainer;
import cpw.mods.fml.common.ModContainer; import cpw.mods.fml.common.ModContainer;
public class FMLFileResourcePack extends FileResourcePack { public class FMLFileResourcePack extends FileResourcePack implements FMLContainerHolder {
private ModContainer container; private ModContainer container;
@ -58,4 +61,10 @@ public class FMLFileResourcePack extends FileResourcePack {
{ {
return ImageIO.read(getInputStreamByName(container.getMetadata().logoFile)); return ImageIO.read(getInputStreamByName(container.getMetadata().logoFile));
} }
@Override
public ModContainer getFMLContainer()
{
return container;
}
} }

View file

@ -4,6 +4,7 @@ import java.awt.image.BufferedImage;
import java.io.ByteArrayInputStream; import java.io.ByteArrayInputStream;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import org.apache.logging.log4j.Level; import org.apache.logging.log4j.Level;
import javax.imageio.ImageIO; import javax.imageio.ImageIO;
@ -12,10 +13,12 @@ import net.minecraft.client.resources.FolderResourcePack;
import com.google.common.base.Charsets; import com.google.common.base.Charsets;
import cpw.mods.fml.common.FMLContainerHolder;
import cpw.mods.fml.common.FMLLog; import cpw.mods.fml.common.FMLLog;
import cpw.mods.fml.common.FMLModContainer;
import cpw.mods.fml.common.ModContainer; import cpw.mods.fml.common.ModContainer;
public class FMLFolderResourcePack extends FolderResourcePack { public class FMLFolderResourcePack extends FolderResourcePack implements FMLContainerHolder {
private ModContainer container; private ModContainer container;
@ -64,4 +67,10 @@ public class FMLFolderResourcePack extends FolderResourcePack {
return ImageIO.read(getInputStreamByName(container.getMetadata().logoFile)); return ImageIO.read(getInputStreamByName(container.getMetadata().logoFile));
} }
@Override
public ModContainer getFMLContainer()
{
return container;
}
} }

View file

@ -0,0 +1,6 @@
package cpw.mods.fml.common;
public interface FMLContainerHolder
{
ModContainer getFMLContainer();
}