Plugin Docs: Plugin Registration - MoreMcmeta/core GitHub Wiki

Simply implementing a plugin interface in a class will not make MoreMcmeta load the plugin; every plugin needs to be registered. How a plugin is registered depends on the mod loader. This page describes methods all plugins must implement, as well as how plugins must be registered on Fabric and Forge.

Any class registered as a plugin must implement the MoreMcmetaMetadataParserPlugin interface or the MoreMcmetaTexturePlugin interface. Both of these plugin interfaces inherit from the ClientPlugin interface, which defines methods that all client-side plugins must implement.

Plugin IDs

The ClientPlugin interface defines an id() method that returns the plugin's ID.

MoreMcmeta plugin IDs must be unique and must match the regular expression [a-z0-9_.-]+. This means IDs can only contain the characters a-z (lowercase only), 0-9, _, ., and -; IDs must be at least one character in length.

No two plugins may have the same ID, even if they are different types of plugins. For example, a MoreMcmetaMetadataParserPlugin cannot have the same ID as a MoreMcmetaTexturePlugin.

Besides id(), the other methods a plugin must implement depend on the plugin's type.

Fabric Registration

MoreMcmeta uses Fabric's entrypoint mechanism to register plugins. In fabric.mod.json, add your plugin class as a moremcmeta-client entrypoint. You can register more plugins by adding more classes to the array of entrypoints. For example:

{
  "entrypoints": {
    "moremcmeta-client": [
      "io.github.moremcmeta.emissiveplugin.fabric.OverlayPluginFabric"
    ]
  }
}

Forge Registration

On Forge, the plugin class should be annotated with @MoreMcmetaClientPlugin. You can annotate multiple classes with @MoreMcmetaClientPlugin to register multiple plugins within the same mod. For example:

@MoreMcmetaClientPlugin
public final class OverlayPluginForge implements MoreMcmetaTexturePlugin {
    @Override
    public String sectionName() {
        return ModConstants.SECTION_NAME;
    }

    @Override
    public MetadataAnalyzer analyzer() {
        return ModConstants.ANALYZER;
    }

    @Override
    public ComponentBuilder componentBuilder() {
        return ModConstants.COMPONENT_BUILDER;
    }

    @Override
    public String id() {
        return ModConstants.MOD_ID;
    }
}