Enhance some error logging related to OBJLoader issues, and RegistryEntries.

This commit is contained in:
LexManos 2016-04-06 01:44:08 -07:00
parent a48fd56fdc
commit fb0bdd1276
2 changed files with 8 additions and 2 deletions

View file

@ -27,6 +27,7 @@ public enum OBJLoader implements ICustomModelLoader {
private IResourceManager manager;
private final Set<String> enabledDomains = new HashSet<String>();
private final Map<ResourceLocation, OBJModel> cache = new HashMap<ResourceLocation, OBJModel>();
private final Map<ResourceLocation, Exception> errors = new HashMap<ResourceLocation, Exception>();
public void addDomain(String domain)
{
@ -38,6 +39,7 @@ public enum OBJLoader implements ICustomModelLoader {
{
this.manager = resourceManager;
cache.clear();
errors.clear();
}
public boolean accepts(ResourceLocation modelLocation)
@ -69,13 +71,17 @@ public enum OBJLoader implements ICustomModelLoader {
{
model = parser.parse();
}
catch (Exception e)
{
errors.put(modelLocation, e);
}
finally
{
cache.put(modelLocation, model);
}
}
OBJModel model = cache.get(file);
if (model == null) throw new ModelLoaderRegistry.LoaderException("Error loading model previously: " + file);
if (model == null) throw new ModelLoaderRegistry.LoaderException("Error loading model previously: " + file, errors.get(modelLocation));
return model;
}
}

View file

@ -60,7 +60,7 @@ public interface IForgeRegistryEntry<V>
String prefix = mc == null || (mc instanceof InjectedModContainer && ((InjectedModContainer)mc).wrappedContainer instanceof FMLContainer) ? "minecraft" : mc.getModId().toLowerCase();
if (!oldPrefix.equals(prefix) && oldPrefix.length() > 0)
{
FMLLog.bigWarning("Dangerous alternative prefix %s for name %s, invalid registry invocation/invalid name?", oldPrefix, name);
FMLLog.bigWarning("Dangerous alternative prefix `%s` for name `%s`, expected `%s` invalid registry invocation/invalid name?", oldPrefix, name, prefix);
prefix = oldPrefix;
}
this.registryName = new ResourceLocation(prefix, name);