类 ModMismatchEvent
java.lang.Object
net.neoforged.bus.api.Event
net.neoforged.neoforge.event.ModMismatchEvent
- 所有已实现的接口:
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
.引用无效
have a result
This event is fired on the mod-specific event bus, on both logical sides.
-
嵌套类概要
嵌套类修饰符和类型类说明static final record
static final record
-
字段概要
字段修饰符和类型字段说明private final LevelStorageSource.LevelDirectory
The level being loaded.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. -
构造器概要
构造器构造器说明ModMismatchEvent
(LevelStorageSource.LevelDirectory levelDirectory, Map<String, org.apache.maven.artifact.versioning.ArtifactVersion> previousVersions, Map<String, org.apache.maven.artifact.versioning.ArtifactVersion> missingVersions) -
方法概要
修饰符和类型方法说明boolean
boolean
@Nullable org.apache.maven.artifact.versioning.ArtifactVersion
getCurrentVersion
(String modId) Gets the current level directory for the world being loaded.@Nullable org.apache.maven.artifact.versioning.ArtifactVersion
getPreviousVersion
(String modId) Fetch a previous version of a given mod, if it has been mismatched.Optional
<net.neoforged.fml.ModContainer> getResolver
(String modid) getVersionDifference
(String modid) void
markResolved
(String modId) Marks the mod version mismatch as having been resolved safely by the current mod.boolean
wasResolved
(String modId) Fetches the status of a mod mismatch handling state.
-
字段详细资料
-
levelDirectory
The level being loaded. Useful for things likeDimensionDataStorage
to manage multiple files changing between mod versions. -
versionDifferences
A set of previously-known versions that have mismatched with the currently loaded versions. -
resolved
Which mods have specified that they have handled version mismatches.
-
-
构造器详细资料
-
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)
-
-
方法详细资料
-
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
@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.- 参数:
modId
- The mod to fetch previous version for.- 返回:
- 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) -
markResolved
Marks the mod version mismatch as having been resolved safely by the current mod. -
wasResolved
Fetches the status of a mod mismatch handling state. -
getVersionDifference
-
getResolver
-
anyUnresolved
public boolean anyUnresolved() -
getUnresolved
-
anyResolved
public boolean anyResolved() -
getResolved
-