跳至正文
OpenAgentSkill
浏览已开放 · 目录记录日期 2026-11-21 · 自动更新和账户服务暂时关闭。
设计与 UI

minecraft-multiloader

Build and maintain Architectury-based Minecraft 26.x or 1.21.x mods that share one codebase across NeoForge and Fabric. Use only when both loaders are required; use minecraft-modding for a single-loader project.

Jahrome907 · 已有 AI 审核记录

安装与使用

运行命令前先阅读来源与依赖说明。复制命令不会自动安装或执行。

npx skills add Jahrome907/minecraft-agent-skills --skill minecraft-multiloader

技能说明


name: minecraft-multiloader description: "Build and maintain Architectury-based Minecraft 26.x or 1.21.x mods that share one codebase across NeoForge and Fabric. Use only when both loaders are required; use minecraft-modding for a single-loader project."

Minecraft Multiloader Skill (Architectury)

What Is Architectury?

Architectury is a framework that lets you write one mod codebase that compiles to both NeoForge and Fabric JARs. The common subproject has a shared API; platform subprojects implement platform-specific behavior behind the @ExpectPlatform abstraction.

Routing Boundaries

  • Use when: one shared codebase must build and ship both NeoForge and Fabric artifacts.
  • Do not use when: the project is single-loader only (minecraft-modding for NeoForge/Fabric, not both).
  • Do not use when: the task is Paper/Bukkit plugin development (minecraft-plugin-dev).
ComponentPurpose
architectury-loomGradle plugin — extends Fabric Loom for multiloader support
architectury-apiRuntime library — abstractions over both platforms
@ExpectPlatformAnnotation marking methods with platform-specific implementations
common/Shared code (no loader-specific APIs)
fabric/Fabric-specific code + entrypoint
neoforge/NeoForge-specific code + entrypoint

Versions (Retained 1.21.11 Lane)

# gradle.properties property names used by this skill's static helper.
# Get every tool version from the exact generated or known-working project.
mod_version=1.0.0
minecraft_version=1.21.11
enabled_platforms=fabric,neoforge

architectury_version=<project pin>
fabric_loader_version=<project pin>
fabric_api_version=<project pin ending in +1.21.11>
neoforge_version=<project pin in the 21.11.x family>
loom_version=<project pin>

Pin architectury_version, the Architectury plugin version, and loom_version from the same generated or known-working project line. This skill deliberately does not publish a copyable dependency matrix: its static helper cannot resolve whether a particular set of versions is compatible.

For the current Minecraft 26.2 / Java 25 lane, use the official Architectury Template Generator only when its version selector offers the exact target. Generate a Multiplatform project with Fabric and NeoForge, then preserve the generated Gradle layout and pins as one set. If the generator does not offer the target, begin with an already working project on that exact line and inspect its resolved build; do not relabel a 1.21.11 template as 26.2. The published template downloads are not a substitute for an exact-current scaffold.

Do not mechanically change only minecraft_version in the retained example: 26.2 is unobfuscated and its Loom/remapping setup differs from 1.21.11.

Bundled References And Helpers

  • Version alignment reference: references/architectury-reference.md
  • Sanity checker: ./scripts/check-version-sanity.sh --root <project>

Run the sanity checker after editing gradle.properties. It is a static syntax-and-version-family preflight: it catches missing keys, snapshot pins, missing fabric / neoforge platforms, and obvious version-family drift. It does not resolve dependencies, prove loader compatibility, or replace the project's Fabric and NeoForge build and smoke tests.


Root Project Layout

my-mod/
├── build.gradle           ← root build (shared config)
├── settings.gradle
├── gradle.properties
├── common/
│   ├── build.gradle
│   └── src/main/java/com/example/mymod/
│       ├── MyMod.java               ← shared init
│       ├── registry/
│       │   └── ModItems.java        ← shared registry declarations
│       └── platform/
│           └── PlatformHelper.java  ← @ExpectPlatform methods
├── fabric/
│   ├── build.gradle
│   └── src/main/
│       ├── java/com/example/mymod/fabric/
│       │   ├── MyModFabric.java          ← Fabric entrypoint
│       ├── java/com/example/mymod/platform/
│       │   └── PlatformHelperImpl.java   ← Fabric @ExpectPlatform implementation
│       └── resources/
│           ├── fabric.mod.json
│           └── assets/...
└── neoforge/
    ├── build.gradle
    └── src/main/
        ├── java/com/example/mymod/neoforge/
        │   ├── MyModNeoForge.java        ← NeoForge @Mod entry
        ├── java/com/example/mymod/platform/
        │   └── PlatformHelperImpl.java   ← NeoForge @ExpectPlatform implementation
        └── resources/
            ├── META-INF/neoforge.mods.toml
            └── assets/...

Legacy Build Template

The old fixed Gradle scripts were a 1.21.11 snapshot and are intentionally not presented as a current scaffold. For either supported lane, read references/legacy-1.21.11-template.md or references/architectury-reference.md before changing generated build files. They preserve version anchors and source-set boundaries without encouraging a partial build script to be copied into a different Minecraft line.


Shared Common Code

common/.../MyMod.java

package com.example.mymod;

import dev.architectury.registry.registries.DeferredRegister;
import dev.architectury.registry.registries.RegistrySupplier;
import net.minecraft.core.registries.Registries;
import net.minecraft.resources.Identifier;
import net.minecraft.resources.ResourceKey;
import net.minecraft.world.item.Item;

public class MyMod {
    public static final String MOD_ID = "mymod";

    // Architectury's DeferredRegister — works on both platforms
    public static final DeferredRegister<Item> ITEMS =
        DeferredRegister.create(MOD_ID, Registries.ITEM);

    public static final RegistrySupplier<Item> MY_ITEM =
        ITEMS.register("my_item", () -> new Item(new Item.Properties().setId(
            ResourceKey.create(Registries.
阅读完整来源 ↗