Fix ModelRegistryEvent firing every time resources reload instead of just once.

This commit is contained in:
David Quintana 2020-08-09 22:04:44 +02:00
parent a8e68328c4
commit a3c4ffd2c1

View file

@ -81,10 +81,14 @@ public class ModelLoaderRegistry
* INTERNAL METHOD, DO NOT CALL * INTERNAL METHOD, DO NOT CALL
*/ */
public static void onModelLoadingStart() public static void onModelLoadingStart()
{
// Minecraft recreates the ModelBakery on resource reload, but this should only run once during init.
if (!registryFrozen)
{ {
net.minecraftforge.fml.ModLoader.get().postEvent(new net.minecraftforge.client.event.ModelRegistryEvent()); net.minecraftforge.fml.ModLoader.get().postEvent(new net.minecraftforge.client.event.ModelRegistryEvent());
registryFrozen = true; registryFrozen = true;
} }
}
/** /**
* Makes system aware of your loader. * Makes system aware of your loader.