@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 annotation is usually paired with a second annotation NetworkMod
, which declares the
network related properties of this mod.
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. It has the NetworkMod
annotation as well, declaring it uses channel
"MyModChannel" and IPacketHandler
class PacketHandler.
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")
// Declare that this is a network mod using the {@link Packet250CustomPayload} channel "MyModChannel", required on the client if it's present
// on the server, with {@link IPacketHandler} class PacketHandler.
{@literal @}NetworkMod(channels = { "MyModChannel" }, clientSideRequired = true, serverSideRequired = false, packetHandler = PacketHandler.class)
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 |
---|---|
String |
modid
The unique mod identifier for this mod
|
Modifier and Type | Optional Element and Description |
---|---|
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.
|
String |
asmHookClass
Deprecated.
|
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.
|
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.
|
String |
dependencies
A simple dependency string for this mod (see modloader's "priorities" string specification)
|
String |
modExclusionList
Deprecated.
|
String |
modLanguage
The language the mod is authored in.
|
String |
name
A user friendly name for the mod
|
boolean |
useMetadata
Whether to use the mcmod.info metadata by default for this mod.
|
String |
version
A version string for this mod
|
public abstract String modid
public abstract String name
public abstract String version
public abstract String dependencies
public abstract boolean useMetadata
public abstract String acceptedMinecraftVersions
public abstract String bukkitPlugin
BukkitPluginRef
annotation on fields.
This may be implemented by a bukkit integration. It is not provided with vanilla FML or MinecraftForge.@Deprecated public abstract String modExclusionList
Mod
annotation has a "getCustomErrorException" method, it will be
called to retrieve a custom error message for display in this case. If two mods have a declared
exclusion which is matched, the screen that is shown is indeterminate.public abstract String certificateFingerprint
FMLFingerprintViolationEvent
event firing prior to any other event on the mod.public abstract String modLanguage
@Deprecated public abstract String asmHookClass
Mod
to do with what it will.IASMHook
.public abstract Mod.CustomProperty[] customProperties