1---2name: fabric3description: Fabric mod development for Minecraft — project setup with Loom, Fabric Loader and Fabric API, registering items/blocks/entities/fluids, networking, events, commands, rendering, data generation, serialization, mixins, class tweakers, and porting. Use when writing or maintaining Fabric mods for Minecraft (26.1+/1.21.x).4---5
6# Fabric (Minecraft Modding)
7
8> Based on fabric-docs at commit `4313db4` (2026-08-05), targeting **Minecraft 26.2** with Fabric Loader 0.19.x, Loom 1.16, Fabric API 0.155.2+26.2 and Mojang mappings (unobfuscated since 26.1). Generated on 2026-08-07.
9
10Fabric is a lightweight modding toolchain for Minecraft: Java Edition built from three components: **Fabric Loader** (mod loading + class transformation), **Fabric API** (events, networking, registry helpers, datagen, tests), and **Fabric Loom** (the Gradle plugin that sets up the development environment). This skill covers the full developer workflow from project scaffolding to advanced rendering and porting.
11
12## Preferences
13
14- Target current Minecraft (26.x) with Mojang mappings; only use Yarn/remapping Loom for pre-26.1 versions.
15- Use modern APIs: data components over NBT, codecs over raw JSON, events over mixins, datagen over hand-written JSON.
16- Register everything in classes with static initializers called from entrypoints; keep client-only code in `src/client`.
17
18## Core & Setup
19
20| Topic | Description | Reference |
21|-------|-------------|-----------|
22| Getting Started | Template generator, JDK 25, IDE setup, launching, sources, building | [core-getting-started](references/core-getting-started.md) |
23| Project Structure | Source sets, resources layout, entrypoints | [core-project-structure](references/core-project-structure.md) |
24| fabric.mod.json | Manifest spec: mandatory fields, entrypoints, dependencies, version ranges | [core-fabric-mod-json](references/core-fabric-mod-json.md) |
25| Fabric Loom | Gradle plugin: DSL options, dependency configurations, tasks, production runs | [core-loom](references/core-loom.md) |
26| Mappings & Migration | Yarn vs Mojang mappings, 26.1 unobfuscation, migrateMappings/Ravel | [core-mappings-and-migration](references/core-mappings-and-migration.md) |
27| Events | Listening to Fabric API events, loot table modification, custom events | [core-events](references/core-events.md) |
28| Networking | Custom payloads, StreamCodecs, sending/receiving, PlayerLookup | [core-networking](references/core-networking.md) |
29| Text & Translations | Components, translatable text, serialization, ChatFormatting | [core-text-and-translations](references/core-text-and-translations.md) |
30| Testing & Debugging | Fabric Loader JUnit, game tests, CI, logging, breakpoints, crash logs | [core-testing-and-debugging](references/core-testing-and-debugging.md) |
31| Key Mappings & Game Rules | KeyMappingHelper, client tick reactions, custom game rules | [core-key-mappings-and-game-rules](references/core-key-mappings-and-game-rules.md) |
32
33## Items
34
35| Topic | Description | Reference |
36|-------|-------------|-----------|
37| First Item | Registration, creative tab, name/texture/model/client item | [items-first-item](references/items-first-item.md) |
38| Food | FoodProperties and Consumable effects | [items-food](references/items-food.md) |
39| Potions | Custom potions and brewing recipes | [items-potions](references/items-potions.md) |
40| Spawn Eggs | SpawnEggItem registration and assets | [items-spawn-egg](references/items-spawn-egg.md) |
41| Tools & Armor | ToolMaterial, tools, ArmorMaterial, armor layers and equipment models | [items-tools-and-armor](references/items-tools-and-armor.md) |
42| Item Models & Appearance | Model JSON structure, display transforms, custom tint sources | [items-models-and-appearance](references/items-models-and-appearance.md) |
43| Creative Tabs | FabricCreativeModeTab builder and registration | [items-creative-tabs](references/items-creative-tabs.md) |
44| Interactions & Enchantments | use/useOn overrides, custom enchantment effects | [items-interactions-and-enchantments](references/items-interactions-and-enchantments.md) |
45| Data Components | Custom DataComponentType, composite components, tooltips | [items-data-components](references/items-data-components.md) |
46
47## Blocks
48
49| Topic | Description | Reference |
50|-------|-------------|-----------|
51| First Block | Registration with/without item, assets, loot tables, tool tags | [blocks-first-block](references/blocks-first-block.md) |
52| Block States & Models | Properties, blockstate JSON, model elements, tinting | [blocks-blockstates-and-models](references/blocks-blockstates-and-models.md) |
53| Block Entities | Types, NBT save/load, client sync, tickers, BERs | [blocks-block-entities](references/blocks-block-entities.md) |
54| Containers & Menus | Container/WorldlyContainer, menus, screens, workstations | [blocks-containers](references/blocks-containers.md) |
55
56## Fluids
57
58| Topic | Description | Reference |
59|-------|-------------|-----------|
60| First Fluid | Source/flowing states, liquid block, bucket, tags, rendering | [fluids-first-fluid](references/fluids-first-fluid.md) |
61
62## Entities
63
64| Topic | Description | Reference |
65|-------|-------------|-----------|
66| First Entity | Registration, goals, models, renderers, animations, synced data | [entities-first-entity](references/entities-first-entity.md) |
67| Attributes | Custom attributes, attach/read/modify | [entities-attributes](references/entities-attributes.md) |
68| Effects & Damage | Custom mob effects, data-driven damage types, death messages, tags | [entities-effects-and-damage](references/entities-effects-and-damage.md) |
69
70## Sounds
71
72| Topic | Description | Reference |
73|-------|-------------|-----------|
74| Playing & Custom Sounds | SoundEvents, categories, volume/pitch, sounds.json | [sounds-using-and-custom](references/sounds-using-and-custom.md) |
75| Dynamic Sounds | Client SoundInstances: looping, tracking sources, transitions | [sounds-dynamic](references/sounds-dynamic.md) |
76
77## Commands
78
79| Topic | Description | Reference |
80|-------|-------------|-----------|
81| Commands & Suggestions | Brigadier basics, requirements, sub-commands, client commands, suggestions | [commands-basics-and-suggestions](references/commands-basics-and-suggestions.md) |
82| Arguments | Built-in arguments, optional args, custom ArgumentType | [commands-arguments](references/commands-arguments.md) |
83
84## Recipes
85
86| Topic | Description | Reference |
87|-------|-------------|-----------|
88| Custom Recipe Types | RecipeInput, Recipe, serializers, recipe book hooks, sync | [recipes-custom-types](references/recipes-custom-types.md) |
89| Extending Vanilla Recipes | Smithing/Crafting/Stonecutter recipe extensions | [recipes-extending-vanilla](references/recipes-extending-vanilla.md) |
90
91## Rendering
92
93| Topic | Description | Reference |
94|-------|-------------|-----------|
95| Basic Concepts | BufferBuilder, vertex formats, matrices, quaternions, render pipelines | [rendering-basic-concepts](references/rendering-basic-concepts.md) |
96| GUI, Screens & Widgets | GuiGraphicsExtractor, scissor, textures/text, custom screens/widgets | [rendering-gui](references/rendering-gui.md) |
97| HUD | HudElementRegistry, DeltaTracker partial ticks | [rendering-hud](references/rendering-hud.md) |
98| World & Particles | LevelRenderEvents, extraction/drawing phases, custom particles | [rendering-world-and-particles](references/rendering-world-and-particles.md) |
99
100## Data Generation
101
102| Topic | Description | Reference |
103|-------|-------------|-----------|
104| Setup | fabric-datagen entrypoint, Pack, providers, runDatagen | [datagen-setup](references/datagen-setup.md) |
105| Models & Translations | Language provider, block/item models, client items | [datagen-models-and-translations](references/datagen-models-and-translations.md) |
106| Server Data | Recipes, tags, loot tables, advancements, enchantments | [datagen-server](references/datagen-server.md) |
107| World Generation | Configured/placed features, placement modifiers, biome modifications | [datagen-features](references/datagen-features.md) |
108
109## Serialization
110
111| Topic | Description | Reference |
112|-------|-------------|-----------|
113| Codecs | Building/composing/transforming codecs, dispatch, stream codecs | [serialization-codecs](references/serialization-codecs.md) |
114| Data Attachments | Attaching synced/persistent data to entities/levels/chunks | [serialization-data-attachments](references/serialization-data-attachments.md) |
115| Saved Data | Level-scoped persistent data with SavedData | [serialization-saved-data](references/serialization-saved-data.md) |
116
117## Mixins & Class Tweakers
118
119| Topic | Description | Reference |
120|-------|-------------|-----------|
121| JVM Bytecode | Descriptors, LVT, operand stack, common instructions | [mixins-bytecode](references/mixins-bytecode.md) |
122| Accessors & Invokers | @Accessor/@Invoker for fields, methods, constructors | [mixins-accessors](references/mixins-accessors.md) |
123| Class Tweakers | Access widening, interface injection, enum extension | [class-tweakers](references/class-tweakers.md) |
124
125## Porting & Misc
126
127| Topic | Description | Reference |
128|-------|-------------|-----------|
129| Porting & Updates | Version bumps, unobfuscation switch, Fabric API rename maps | [porting-and-updates](references/porting-and-updates.md) |
130| Resource Conditions & Stats | Conditional loading, custom statistics | [misc-resource-conditions-and-statistics](references/misc-resource-conditions-and-statistics.md) |
131
132## Quick Reference
133
134### Minimal build.gradle (Minecraft 26.2)
135
136```gradle
137plugins { id 'net.fabricmc.fabric-loom' version '1.16' }
138
139dependencies {
140 minecraft "com.mojang:minecraft:26.2"
141 mappings loom.officialMojangMappings()
142 modImplementation "net.fabricmc.fabric-api:fabric-api:0.155.2+26.2"
143 implementation "net.fabricmc:fabric-loader:0.19.2"
144}
145
146loom {
147 splitEnvironmentSourceSets()
148 mods { "example-mod" { sourceSet sourceSets.main; sourceSet sourceSets.client } }
149}
150```
151
152### Minimal fabric.mod.json
153
154```json
155{
156 "schemaVersion": 1,
157 "id": "example-mod",
158 "version": "1.0.0",
159 "entrypoints": {
160 "main": ["com.example.ExampleMod"],
161 "client": ["com.example.ExampleModClient"]
162 },
163 "depends": {
164 "fabricloader": ">=0.19.0",
165 "minecraft": "~26.2",
166 "java": ">=25",
167 "fabric-api": "*"
168 }
169}
170```
171
172### Common Commands
173
174```bash
175./gradlew runClient # dev run
176./gradlew build # build release JAR (build/libs)
177./gradlew genSources # decompile Minecraft sources
178./gradlew runDatagen # run data generation
179./gradlew runClientGameTest # client game tests
180./gradlew validateAccessWidener # validate class tweaker entries
181```
182
183### Key API Notes
184
185- Registration: `Registry.register(BuiltInRegistries.X, Identifier.fromNamespaceAndPath("mod", "name"), value)`.
186- 26.x uses Mojang names: `Level` (not World), `BlockPos`, `ItemStack`, `Item.Properties`, `BlockBehaviour.Properties`, `FriendlyByteBuf`.
187- Entrypoints: `ModInitializer`, `ClientModInitializer`, `DedicatedServerModInitializer`, `DataGeneratorEntrypoint` (`fabric-datagen`).