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