Mod guide banner: Mod Development Basics: Build Your First Item with Fabric (Dev Guide) 🛠️ Mod Development Basics: B… Dev Guide MOD GUIDE

Three Prerequisites: JDK, IDE and Gradle

Mod development is a plain Java project, so the first step is the right JDK: recent game versions require Java 21, older ones Java 17, and a mismatch fails immediately with an unsupported class version error. IntelliJ IDEA Community is the recommended IDE for its Gradle support; VS Code works but debugging is weaker. You never install Gradle manually — template projects ship a wrapper, so ./gradlew downloads the matching version. You also need mappings: game code is obfuscated, and Fabric typically uses Yarn or Mojang's official mappings. Mappings decide the class and method names you see, so the wrong choice makes every tutorial mismatch.

Two Build Plugins: Loom and NeoGradle

Fabric uses Fabric Loom, a Gradle plugin that downloads and merges client and server jars, applies mappings, generates runClient and runServer configurations, and handles Mixin annotation processing plus jar-in-jar dependencies. Forge and NeoForge historically used ForgeGradle; new projects mostly use NeoGradle or ModDevGradle, with similar duties: decompile, patch, and set up the dev environment. The easiest entry is not hand-building a project but the official template generator: enter a mod name, package and target version, and get a project that runs. Get runClient launching successfully once before touching code.

Project Layout and Two Metadata Files

In a generated project, gradle.properties holds the group, version and dependencies; src/main/java holds code; src/main/resources/assets/<modid> holds client assets (models, textures, language files); and src/main/resources/data/<modid> holds data (recipes, loot tables, tags). Metadata is the identity card: Fabric uses fabric.mod.json declaring id, name, version, entrypoints and depends (Fabric API is usually a required dependency); Forge and NeoForge use mods.toml or neoforge.mods.toml. The mod ID must be lowercase with no spaces, and it threads through package names, asset folders and recipe namespaces — renaming it later means starting over.

Register an Item and Give It Assets

Registration must happen during mod initialization: on Fabric, implement ModInitializer#onInitialize and call Registry.register against Registries.ITEM with an Identifier.of(modId, itemName). Newer versions use Identifier.of while older ones use new Identifier — the single most common place old tutorials break. The item itself is new Item(new Item.Settings()), with stack size or food properties chained on Settings. Code alone is invisible in game, so add three assets: a model JSON under models/item, a 16×16 PNG under textures/item, and a translation key in lang/zh_cn.json. Blocks need one more step — register the matching BlockItem as well, or it never appears in the inventory.

Running, Building and Publishing

During development, ./gradlew runClient launches a dev client; restart after changes, and if the item shows in the creative inventory the whole chain works. For release, ./gradlew build writes to build/libs — upload the jar without the -sources suffix. Three lessons: first, treat client and server separately, because render-only code must stay client-side while logic must run on both or dedicated servers crash; second, follow semantic versioning and declare supported loaders and game versions in metadata, since downloading the wrong build is the top player complaint; third, publish on Modrinth and CurseForge first — Modrinth reviews fast and can mirror to CurseForge — and use GitHub Releases for snapshots and source. Mixin is the bytecode technique for altering vanilla behavior, but it is not required for a first mod.

✓ Last reviewed 2026-09-22 · applicable version noted per entry Minecraft mechanics change with every update — this guide is only guaranteed to work in the stated version.

Comments

Powered by GitHub Discussions — sign in with GitHub to comment.