Introduce IContextSetter for events.

This will set the active mod container for events using the normal EventBus.
Fixes improper warnings from initializing mods using the new Registry events.
Modders, you should not use this as it has many performance implementations
and if abused will slow down the event bus A LOT. ActiveModContainer is not
thread safe.
This commit is contained in:
LexManos committed 2016-10-08 16:30:53 -07:00
1 parent c0db34796b
commit bc303074f6
6 files changed
+93 -30

No files matched your search

@@ -22,6 +22,7 @@ package net.minecraftforge.event;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.common.eventhandler.Event;
import net.minecraftforge.fml.common.eventhandler.GenericEvent;
import net.minecraftforge.fml.common.eventhandler.IContextSetter;
import net.minecraftforge.fml.common.registry.IForgeRegistry;
import net.minecraftforge.fml.common.registry.IForgeRegistryEntry;
import net.minecraftforge.fml.common.registry.PersistentRegistryManager;
@@ -30,7 +31,7 @@ import net.minecraftforge.fml.common.registry.PersistentRegistryManager;
/**
* RegistryEvent supertype.
*/
public class RegistryEvent<T extends IForgeRegistryEntry<T>> extends GenericEvent<T>
public class RegistryEvent<T extends IForgeRegistryEntry<T>> extends GenericEvent<T> implements IContextSetter
{
RegistryEvent(Class<T> clazz) {
super(clazz);