mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-26 23:13:15 +00:00
Reintroduce ObfuscationReflestionHelper closes #5373
This commit is contained in:
1 parent
e8ae18efda
commit
053c5300ed
4 files changed
+232
-125
No files matched your search
@@ -58,10 +58,12 @@ import net.minecraft.network.ServerStatusResponse;
|
||||
import net.minecraft.resources.AbstractResourcePack;
|
||||
import net.minecraft.resources.FallbackResourceManager;
|
||||
import net.minecraft.resources.IResourcePack;
|
||||
import net.minecraft.resources.SimpleReloadableResourceManager;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.world.storage.WorldSummary;
|
||||
import net.minecraftforge.fml.StartupQuery;
|
||||
import net.minecraftforge.fml.client.gui.GuiAccessDenied;
|
||||
import net.minecraftforge.fml.common.ObfuscationReflectionHelper;
|
||||
import net.minecraftforge.forgespi.language.IModInfo;
|
||||
import net.minecraftforge.fml.packs.ModFileResourcePack;
|
||||
import net.minecraftforge.registries.GameData;
|
||||
@@ -233,7 +235,7 @@ public class ClientHooks
|
||||
// We can't handle many unicode points in the splash renderer
|
||||
return DISALLOWED_CHAR_MATCHER.removeFrom(net.minecraft.util.StringUtils.stripControlCodes(message));
|
||||
}
|
||||
|
||||
|
||||
private static SetMultimap<String,ResourceLocation> missingTextures = HashMultimap.create();
|
||||
private static Set<String> badTextureDomains = Sets.newHashSet();
|
||||
private static Table<String, String, Set<ResourceLocation>> brokenTextures = HashBasedTable.create();
|
||||
@@ -265,7 +267,7 @@ public class ClientHooks
|
||||
Logger logger = LogManager.getLogger("FML.TEXTURE_ERRORS");
|
||||
logger.error(Strings.repeat("+=", 25));
|
||||
logger.error("The following texture errors were found.");
|
||||
Map<String,FallbackResourceManager> resManagers = null;// TODO ObfuscationReflectionHelper.getPrivateValue(SimpleReloadableResourceManager.class, (SimpleReloadableResourceManager)Minecraft.getMinecraft().getResourceManager(), "field_110548"+"_a");
|
||||
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);
|
||||
@@ -280,7 +282,7 @@ public class ClientHooks
|
||||
}
|
||||
else
|
||||
{
|
||||
List<IResourcePack> resPacks = null;//ObfuscationReflectionHelper.getPrivateValue(FallbackResourceManager.class, fallbackResourceManager, "field_110540"+"_a");
|
||||
List<IResourcePack> resPacks = fallbackResourceManager.resourcePacks;
|
||||
logger.error(" domain {} has {} location{}:",resourceDomain, resPacks.size(), resPacks.size() != 1 ? "s" :"");
|
||||
for (IResourcePack resPack : resPacks)
|
||||
{
|
||||
@@ -291,9 +293,7 @@ public class ClientHooks
|
||||
}
|
||||
else if (resPack instanceof AbstractResourcePack)
|
||||
{
|
||||
AbstractResourcePack resourcePack = (AbstractResourcePack) resPack;
|
||||
File resPath = null;// TODO bfuscationReflectionHelper.getPrivateValue(AbstractResourcePack.class, resourcePack, "field_110597"+"_b");
|
||||
logger.error(" resource pack at path {}",resPath.getPath());
|
||||
logger.error(" resource pack at path {}", ((AbstractResourcePack)resPack).file.getPath());
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -52,84 +52,4 @@ public class TextureTracker
|
||||
}
|
||||
badType.add(resourceLocation);
|
||||
}
|
||||
|
||||
public static 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));
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user