Package net.minecraftforge.fml
Class ModContainer
- java.lang.Object
-
- net.minecraftforge.fml.ModContainer
-
- Direct Known Subclasses:
FMLModContainer
,MinecraftModLanguageProvider.MinecraftModContainer
,ModLoader.ErroredModContainer
public abstract class ModContainer extends java.lang.Object
The container that wraps around mods in the system.The philosophy is that individual mod implementation technologies should not impact the actual loading and management of mod code. This class provides a mechanism by which we can wrap actual mod code so that the loader and other facilities can treat mods at arms length.
- Author:
- cpw
-
-
Field Summary
Fields Modifier and Type Field Description protected java.util.Map<ModLoadingStage,java.lang.Runnable>
activityMap
protected java.util.Optional<java.util.function.Consumer<ModConfig.ModConfigEvent>>
configHandler
protected java.util.EnumMap<ModConfig.Type,ModConfig>
configs
protected java.util.function.Supplier<?>
contextExtension
protected java.util.Map<ExtensionPoint,java.util.function.Supplier<?>>
extensionPoints
protected java.lang.String
modId
protected net.minecraftforge.forgespi.language.IModInfo
modInfo
protected ModLoadingStage
modLoadingStage
protected java.lang.String
namespace
-
Constructor Summary
Constructors Constructor Description ModContainer()
Errored container state, used for filtering.ModContainer(net.minecraftforge.forgespi.language.IModInfo info)
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected <T extends net.minecraftforge.eventbus.api.Event & IModBusEvent>
voidacceptEvent(T e)
Accept an arbitrary event for processing by the mod.void
addConfig(ModConfig modConfig)
static <T extends net.minecraftforge.eventbus.api.Event & IModBusEvent>
java.util.concurrent.CompletableFuture<java.lang.Void>buildTransitionHandler(ModContainer target, ModLoadingStage.EventGenerator<T> eventGenerator, java.util.function.BiFunction<ModLoadingStage,java.lang.Throwable,ModLoadingStage> stateChangeHandler, java.util.concurrent.Executor executor)
void
dispatchConfigEvent(ModConfig.ModConfigEvent event)
ModLoadingStage
getCurrentState()
<T> java.util.Optional<T>
getCustomExtension(ExtensionPoint<T> point)
abstract java.lang.Object
getMod()
java.lang.String
getModId()
net.minecraftforge.forgespi.language.IModInfo
getModInfo()
java.lang.String
getNamespace()
abstract boolean
matches(java.lang.Object mod)
Does this mod match the supplied mod?<T> void
registerExtensionPoint(ExtensionPoint<T> point, java.util.function.Supplier<T> extension)
-
-
-
Field Detail
-
modId
protected final java.lang.String modId
-
namespace
protected final java.lang.String namespace
-
modInfo
protected final net.minecraftforge.forgespi.language.IModInfo modInfo
-
modLoadingStage
protected ModLoadingStage modLoadingStage
-
contextExtension
protected java.util.function.Supplier<?> contextExtension
-
activityMap
protected final java.util.Map<ModLoadingStage,java.lang.Runnable> activityMap
-
extensionPoints
protected final java.util.Map<ExtensionPoint,java.util.function.Supplier<?>> extensionPoints
-
configs
protected final java.util.EnumMap<ModConfig.Type,ModConfig> configs
-
configHandler
protected java.util.Optional<java.util.function.Consumer<ModConfig.ModConfigEvent>> configHandler
-
-
Method Detail
-
getModId
public final java.lang.String getModId()
- Returns:
- the modid for this mod
-
getNamespace
public final java.lang.String getNamespace()
- Returns:
- the resource prefix for the mod
-
getCurrentState
public ModLoadingStage getCurrentState()
- Returns:
- The current loading stage for this mod
-
buildTransitionHandler
public static <T extends net.minecraftforge.eventbus.api.Event & IModBusEvent> java.util.concurrent.CompletableFuture<java.lang.Void> buildTransitionHandler(ModContainer target, ModLoadingStage.EventGenerator<T> eventGenerator, java.util.function.BiFunction<ModLoadingStage,java.lang.Throwable,ModLoadingStage> stateChangeHandler, java.util.concurrent.Executor executor)
-
getModInfo
public net.minecraftforge.forgespi.language.IModInfo getModInfo()
- Returns:
- the modinfo used to create this mod instance
-
getCustomExtension
public <T> java.util.Optional<T> getCustomExtension(ExtensionPoint<T> point)
-
registerExtensionPoint
public <T> void registerExtensionPoint(ExtensionPoint<T> point, java.util.function.Supplier<T> extension)
-
addConfig
public void addConfig(ModConfig modConfig)
-
dispatchConfigEvent
public void dispatchConfigEvent(ModConfig.ModConfigEvent event)
-
matches
public abstract boolean matches(java.lang.Object mod)
Does this mod match the supplied mod?- Parameters:
mod
- to compare- Returns:
- if the mod matches
-
getMod
public abstract java.lang.Object getMod()
- Returns:
- the mod object instance
-
acceptEvent
protected <T extends net.minecraftforge.eventbus.api.Event & IModBusEvent> void acceptEvent(T e)
Accept an arbitrary event for processing by the mod. Probably posted to an event bus in the lower level container.- Parameters:
e
- Event to accept
-
-