Class ModMismatchEvent

java.lang.Object
net.neoforged.bus.api.Event
net.neoforged.neoforge.event.ModMismatchEvent
All Implemented Interfaces:
net.neoforged.fml.event.IModBusEvent

public class ModMismatchEvent extends net.neoforged.bus.api.Event implements net.neoforged.fml.event.IModBusEvent
Fires when the mod loader is in the process of loading a world that was last saved with mod versions that differ from the currently-loaded versions. This can be used to enqueue work to run at a later point, such as multi-file migration of data.

Note that level and world information has not yet been fully loaded; as such, it is unsafe to access server or level information during handling of this event.

This event is not cancellable, and does not

invalid reference
have a result
.

This event is fired on the mod-specific event bus, on both logical sides.

  • Field Details Link icon

  • Constructor Details Link icon

    • ModMismatchEvent Link icon

      @Internal public ModMismatchEvent(LevelStorageSource.LevelDirectory levelDirectory, Map<String,org.apache.maven.artifact.versioning.ArtifactVersion> previousVersions, Map<String,org.apache.maven.artifact.versioning.ArtifactVersion> missingVersions)
  • Method Details Link icon

    • getLevelDirectory Link icon

      public LevelStorageSource.LevelDirectory getLevelDirectory()
      Gets the current level directory for the world being loaded. Can be used for file operations and manual modification of mod files before world load.
    • getPreviousVersion Link icon

      @Nullable public @Nullable org.apache.maven.artifact.versioning.ArtifactVersion getPreviousVersion(String modId)
      Fetch a previous version of a given mod, if it has been mismatched.
      Parameters:
      modId - The mod to fetch previous version for.
      Returns:
      The previously known mod version, or Optional.empty() if unknown/not found.
    • getCurrentVersion Link icon

      @Nullable public @Nullable org.apache.maven.artifact.versioning.ArtifactVersion getCurrentVersion(String modId)
    • markResolved Link icon

      public void markResolved(String modId)
      Marks the mod version mismatch as having been resolved safely by the current mod.
    • wasResolved Link icon

      public boolean wasResolved(String modId)
      Fetches the status of a mod mismatch handling state.
    • getVersionDifference Link icon

      public Optional<ModMismatchEvent.MismatchedVersionInfo> getVersionDifference(String modid)
    • getResolver Link icon

      public Optional<net.neoforged.fml.ModContainer> getResolver(String modid)
    • anyUnresolved Link icon

      public boolean anyUnresolved()
    • getUnresolved Link icon

    • anyResolved Link icon

      public boolean anyResolved()
    • getResolved Link icon