• Forums

Navigation

  • Home
  • Style Guide
  • Getting Started
    • Home
    • Structuring Your Mod
    • Forge Update Checker
    • Dependency Management
    • Debug Profiler
  • Concepts
    • Sides
    • Resources
    • Registries
    • The Fingerprint Violation Event
    • Internationalization and localization
  • Blocks
    • Home
    • Intro to Blockstates
    • Interaction
  • Animation API
    • Intro to the Animation API
    • Armatures
    • Animation State Machines
    • Using the API
  • Tile Entities
    • Home
    • Renderer
  • Items
    • Home
    • Loot Tables
  • Models
    • Intro to Models
    • Model Files
    • Blockstates
      • Intro to Blockstate JSONs
      • Forge Blockstate JSON
    • Connecting Blocks and Items to Models
    • Coloring Textures
    • Item Property Overrides
    • Advanced Models
      • Intro to Advanced Models
      • IModel
      • IModelState and IModelPart
      • IBakedModel
      • Extended Blockstates
      • Perspective
      • ItemOverrideList
      • ICustomModelLoader
  • Rendering
    • TileEntityItemStackRenderer
  • Events
    • Basic Usage
  • Networking
    • Home
    • Overview
    • SimpleImpl
    • Entities
  • Data Storage
    • Capabilities
    • World Saved Data
    • Extended Entity Properties
    • Config Annotations
  • Utilities
    • Recipes
    • Tags
    • PermissionAPI
  • Effects
    • Sounds
  • Conventions
    • Versioning
    • Locations
    • Loading Stages
      • Setup
      • Sided Setup
      • IMC Enqueue
      • IMC Process
      • Other Important Events
  • Contributing to Forge
    • Getting Started
    • PR Guidelines

Loading Stages

The Forge loading process has four main phases. All of these events shown are fired on the mod-specific eventbus, not the global Forge event bus MinecraftForge.EVENT_BUS Handlers should be registered either using @EventBusSubscriber(bus = Bus.MOD) or in the mod object constructor as follows:

@Mod("mymod")
public class MyMod {
  public MyMod() {
    FMLModLoadingContext.get().getModEventBus().registerListener(this::commonSetup);
  } 

  private void commonSetup(FMLCommonSetupEvent evt) { ... }
}

Warning

All four of the below events are called for all mods in parallel. That is, all mods will concurrently receive common setup, FML will wait for them all to finish, then all mods will concurrently receive sided setup, and so forth. Mods must take care to be thread safe, especially when calling other mods’ API’s and accessing Vanilla systems, which are not thread safe in general. This can be done using the DeferredWorkQueue class.

Setup

FMLCommonSetupEvent is the first to fire, and is fired early in the Minecraft starting process. Registry events are fired before this event, so you can expect all registry objects to be valid by the time this runs. Common actions to perform in common setup are:

  • Creating and reading the config files
  • Registering Capabilities

Sided Setup

FMLClientSetupEvent and FMLDedicatedServerSetupEvent are fired after common setup, and are where physical side-specific initialization should occur. Common actions to perform here are registering client-side only things such as key bindings.

IMC Enqueue

Here, mods should send messages to all other mods they are interested in integrating with, using the InterModComms.sendTo() method.

IMC Process

Here, mods should process all the messages they have received from other mods and set up integrations appropriately. A mod may retrieve the messages that have been sent to it using the InterModComms.getMessages() method.

Other Important Events

  • FMLServerStartingEvent: Register Commands
Built with MkDocs using a custom theme. Hosted by Read the Docs.
Enable Dark Theme