集成

集成

用于更好模组集成的库。

基础库

集成

这是一个帮助其他模组更轻松实现集成的库模组。

本模组基于加载器的 API,而非 Minecraft 的 API。因此只要加载器支持,它就可以在任何版本上运行。

如何使用

核心 API

  • IntegrationExecutor:仅在目标模组已加载时安全地运行集成代码。
  • EntryPointManager:基于 Annotation(Forge/NeoForge)和 EntryPoint(Fabric)的可自定义入口点。

示例

与 example-mod 集成

IntegrationExecutor.runWhenLoad("example-mod",()->()->{
        //Your code here.
        });

自定义入口点


@EntryPointProvider(slug = "example-mod")
public class ExampleModIntegration implements IntegrationEntryPoint {
    //Your code here
}
//fabric.mod.json
{
  //Other parts
  "entrypoints": {
    "example-mod": [
      "xxx.ExampleModIntegration"
    ]
  },
}

获取此入口点:

EntryPointManager.getEntryPoints("example-mod");

请不要把这个mod搬到mcmod.cn,不然重生会打死我的(((