Fix multiple registrations of reloading hooks in custom model loaders.
This commit is contained in:
parent
2c6af18a81
commit
7e7b855ddf
1 changed files with 10 additions and 5 deletions
|
@ -26,6 +26,7 @@ public class ModelLoaderRegistry
|
|||
{
|
||||
private static final Set<ICustomModelLoader> loaders = new HashSet<ICustomModelLoader>();
|
||||
private static final Map<ResourceLocation, IModel> cache = new HashMap<ResourceLocation, IModel>();
|
||||
private static boolean registered = false;
|
||||
|
||||
// Forge built-in loaders
|
||||
static
|
||||
|
@ -44,6 +45,8 @@ public class ModelLoaderRegistry
|
|||
public static void registerLoader(ICustomModelLoader loader)
|
||||
{
|
||||
loaders.add(loader);
|
||||
if(!registered)
|
||||
{
|
||||
((IReloadableResourceManager) Minecraft.getMinecraft().getResourceManager()).registerReloadListener(new IResourceManagerReloadListener()
|
||||
{
|
||||
public void onResourceManagerReload(IResourceManager manager)
|
||||
|
@ -51,6 +54,8 @@ public class ModelLoaderRegistry
|
|||
for (ICustomModelLoader loader : loaders) loader.onResourceManagerReload(manager);
|
||||
}
|
||||
});
|
||||
registered = true;
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean loaded(ResourceLocation location)
|
||||
|
|
Loading…
Reference in a new issue