@Retention(value=RUNTIME)
@Target(value=TYPE)
public @interface Mod
FMLEvent
at pre-defined times during the loading of the game, based on where you have applied the Mod.EventHandler
annotation.
This is a simple example of a Mod. It has the modId of "MyModId", the name of "My example mod", it is version 1.0, and depends on FML being loaded.
package mymod;
// Declare that this is a mod with modId "MyModId", name "My example mod", version "1.0" and dependency on FML.
{@literal @}Mod(modId="MyModId",name="My example mod",version="1.0",dependencies="required-after:FML")
public class MyMod {
// Populate this field with the instance of the mod created by FML
{@literal @}Instance("MyModId")
public MyMod instance;
// Mark this method for receiving an {@link FMLEvent} (in this case, it's the {@link FMLPreInitializationEvent})
{@literal @}EventHandler public void preInit(FMLPreInitializationEvent event)
{
// Do stuff in pre-init phase (read config, create blocks and items, register them)
}
}
Modifier and Type | Required Element and Description |
---|---|
java.lang.String |
modid
The unique mod identifier for this mod
|
Modifier and Type | Optional Element and Description |
---|---|
java.lang.String |
acceptableRemoteVersions
A replacement for the no-longer-existing "versionRange" of NetworkMod.
|
java.lang.String |
acceptableSaveVersions
A version range specifying compatible save version information.
|
java.lang.String |
acceptedMinecraftVersions
The acceptable range of minecraft versions that this mod will load and run in
The default ("empty string") indicates that only the current minecraft version is acceptable.
|
java.lang.String |
asmHookClass
Deprecated.
|
java.lang.String |
bukkitPlugin
An optional bukkit plugin that will be injected into the bukkit plugin framework if
this mod is loaded into the FML framework and the bukkit coremod is present.
|
boolean |
canBeDeactivated
If your mod doesn't have a runtime persistent effect on the state of the game, and can be disabled without side effects
(minimap mods, graphical tweak mods) then you can set true here and receive the FMLDeactivationEvent to perform deactivation
tasks.
|
java.lang.String |
certificateFingerprint
Specifying this field allows for a mod to expect a signed jar with a fingerprint matching this value.
|
Mod.CustomProperty[] |
customProperties
A list of custom properties for this mod.
|
java.lang.String |
dependencies
A simple dependency string for this mod (see modloader's "priorities" string specification)
|
java.lang.String |
guiFactory
An optional GUI factory for this mod.
|
java.lang.String |
modLanguage
The language the mod is authored in.
|
java.lang.String |
modLanguageAdapter
The language adapter to be used to load this mod.
|
java.lang.String |
name
A user friendly name for the mod
|
boolean |
useMetadata
Whether to use the mcmod.info metadata by default for this mod.
|
java.lang.String |
version
A version string for this mod
|
public abstract java.lang.String dependencies
public abstract boolean useMetadata
public abstract java.lang.String acceptedMinecraftVersions
public abstract java.lang.String acceptableRemoteVersions
NetworkCheckHandler
annotation on a method in this class.public abstract java.lang.String acceptableSaveVersions
SaveInspectionHandler
instead.public abstract java.lang.String bukkitPlugin
BukkitPluginRef
annotation on fields.
This may be implemented by a bukkit integration. It is not provided with vanilla FML or MinecraftForge.public abstract java.lang.String certificateFingerprint
FMLFingerprintViolationEvent
event firing prior to any other event on the mod.public abstract java.lang.String modLanguage
public abstract java.lang.String modLanguageAdapter
ILanguageAdapter
just like the Java and Scala adapters.
A class with an invalid constructor or that doesn't implement ILanguageAdapter
will throw an exception and
halt loading.@Deprecated public abstract java.lang.String asmHookClass
Mod
to do with what it will.IASMHook
.public abstract boolean canBeDeactivated
public abstract java.lang.String guiFactory
IModGuiFactory
that will be instantiated
on the client side, and will have certain configuration/options guis requested from it.IModGuiFactory
public abstract Mod.CustomProperty[] customProperties