Class ModContainer

java.lang.Object
net.minecraftforge.fml.ModContainer
Direct Known Subclasses:
FMLModContainer, MinecraftModContainer, ModLoader.ErroredModContainer

public abstract class ModContainer extends 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 Details

  • Constructor Details

    • ModContainer

      public ModContainer(net.minecraftforge.forgespi.language.IModInfo info)
    • ModContainer

      ModContainer()
      Errored container state, used for filtering. Does nothing.
  • Method Details

    • getModId

      public final String getModId()
      Returns:
      the modid for this mod
    • getNamespace

      public final 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> CompletableFuture<Void> buildTransitionHandler(ModContainer target, IModStateTransition.EventGenerator<T> eventGenerator, BiFunction<ModLoadingStage,​Throwable,​ModLoadingStage> stateChangeHandler, Executor executor)
    • getModInfo

      public net.minecraftforge.forgespi.language.IModInfo getModInfo()
    • getCustomExtension

      public <T extends Record> Optional<T> getCustomExtension(Class<? extends IExtensionPoint<T>> point)
    • registerExtensionPoint

      public <T extends Record & IExtensionPoint<T>> void registerExtensionPoint(Class<? extends IExtensionPoint<T>> point, Supplier<T> extension)
    • addConfig

      public void addConfig(ModConfig modConfig)
    • dispatchConfigEvent

      public void dispatchConfigEvent(IConfigEvent event)
    • matches

      public abstract boolean matches(Object mod)
      Does this mod match the supplied mod?
      Parameters:
      mod - to compare
      Returns:
      if the mod matches
    • getMod

      public abstract 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