Package net.minecraftforge.event
Class ModMismatchEvent
java.lang.Object
net.minecraftforge.eventbus.api.Event
net.minecraftforge.event.ModMismatchEvent
- All Implemented Interfaces:
- 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 have a result.
This event is fired on the mod-specific event bus, on both logical sides.
- 
Nested Class SummaryNested ClassesModifier and TypeClassDescriptionstatic final recordstatic final recordNested classes/interfaces inherited from class net.minecraftforge.eventbus.api.Eventnet.minecraftforge.eventbus.api.Event.HasResult, net.minecraftforge.eventbus.api.Event.Result
- 
Field SummaryFieldsModifier and TypeFieldDescriptionprivate final LevelStorageSource.LevelDirectoryThe level being loaded.private final HashMap<String,ModContainer> Which mods have specified that they have handled version mismatches.private final HashMap<String,ModMismatchEvent.MismatchedVersionInfo> A set of previously-known versions that have mismatched with the currently loaded versions.
- 
Constructor SummaryConstructorsConstructorDescriptionModMismatchEvent(LevelStorageSource.LevelDirectory levelDirectory, Map<String, org.apache.maven.artifact.versioning.ArtifactVersion> previousVersions, Map<String, org.apache.maven.artifact.versioning.ArtifactVersion> missingVersions) 
- 
Method SummaryModifier and TypeMethodDescriptionbooleanboolean@Nullable org.apache.maven.artifact.versioning.ArtifactVersiongetCurrentVersion(String modid) Gets the current level directory for the world being loaded.@Nullable org.apache.maven.artifact.versioning.ArtifactVersiongetPreviousVersion(String modId) Fetch a previous version of a given mod, if it has been mismatched.getResolver(String modid) getVersionDifference(String modid) voidmarkResolved(String modId) Marks the mod version mismatch as having been resolved safely by the current mod.booleanwasResolved(String modId) Fetches the status of a mod mismatch handling state.Methods inherited from class net.minecraftforge.eventbus.api.EventgetListenerList, getPhase, getResult, hasResult, isCancelable, isCanceled, setCanceled, setPhase, setResult
- 
Field Details- 
levelDirectoryThe level being loaded. Useful for things likeDimensionDataStorageto manage multiple files changing between mod versions.
- 
versionDifferencesA set of previously-known versions that have mismatched with the currently loaded versions.
- 
resolvedWhich mods have specified that they have handled version mismatches.
 
- 
- 
Constructor Details- 
ModMismatchEvent@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- 
getLevelDirectoryGets 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@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@Nullable public @Nullable org.apache.maven.artifact.versioning.ArtifactVersion getCurrentVersion(String modid) 
- 
markResolvedMarks the mod version mismatch as having been resolved safely by the current mod.
- 
wasResolvedFetches the status of a mod mismatch handling state.
- 
getVersionDifference
- 
getResolver
- 
anyUnresolvedpublic boolean anyUnresolved()
- 
getUnresolved
- 
anyResolvedpublic boolean anyResolved()
- 
getResolved
 
-