Moved some events to the Mod's event bus. You'll need to update which bus

you're listening to for these. (The Mod event bus is the only one actively
dispatching events during model loading).

ModelRegistryEvent, ModelBakeEvent, TextureStitchEvent.Pre, TextureStitchEvent.Post, ColourHandlerEvent.Block, ColourHandlerEvent.Item

Signed-off-by: cpw <[email protected]>
This commit is contained in:
cpw committed 2019-06-22 20:36:07 -04:00
1 parent 89baeb3d5d
commit d966746fbf
5 files changed
+28 -9

No files matched your search

@@ -27,6 +27,7 @@ import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.client.event.ModelRegistryEvent;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.common.capabilities.CapabilityManager;
import net.minecraftforge.eventbus.api.Event;
import net.minecraftforge.fml.config.ConfigTracker;
import net.minecraftforge.fml.config.ModConfig;
import net.minecraftforge.fml.event.lifecycle.GatherDataEvent;
@@ -118,16 +119,16 @@ public class ModLoader
return INSTANCE == null ? INSTANCE = new ModLoader() : INSTANCE;
}
private static Runnable fireClientEvents()
private Runnable fireClientEvents()
{
return ()->MinecraftForge.EVENT_BUS.post(new ModelRegistryEvent());
return ()->postEvent(new ModelRegistryEvent());
}
public void loadMods() {
DistExecutor.runWhenOn(Dist.CLIENT, ()->()-> ConfigTracker.INSTANCE.loadConfigs(ModConfig.Type.CLIENT, FMLPaths.CONFIGDIR.get()));
ConfigTracker.INSTANCE.loadConfigs(ModConfig.Type.COMMON, FMLPaths.CONFIGDIR.get());
dispatchAndHandleError(LifecycleEventProvider.SETUP);
DistExecutor.runWhenOn(Dist.CLIENT, ModLoader::fireClientEvents);
DistExecutor.runWhenOn(Dist.CLIENT, this::fireClientEvents);
dispatchAndHandleError(LifecycleEventProvider.SIDED_SETUP);
}
@@ -200,6 +201,10 @@ public class ModLoader
}
}
public void postEvent(Event e) {
ModList.get().forEachModContainer((id, mc) -> mc.acceptEvent(e));
}
public void finishMods()
{
dispatchAndHandleError(LifecycleEventProvider.ENQUEUE_IMC);