fabric

v2026.09.24

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).

GitHub
安装命令
npx skhub add hairyf/fabric
Markdown
SKILL.md

Fabric (Minecraft Modding)

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.

Fabric 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.

Preferences

  • Target current Minecraft (26.x) with Mojang mappings; only use Yarn/remapping Loom for pre-26.1 versions.
  • Use modern APIs: data components over NBT, codecs over raw JSON, events over mixins, datagen over hand-written JSON.
  • Register everything in classes with static initializers called from entrypoints; keep client-only code in src/client.

Core & Setup

TopicDescriptionReference
Getting StartedTemplate generator, JDK 25, IDE setup, launching, sources, buildingcore-getting-started
Project StructureSource sets, resources layout, entrypointscore-project-structure
fabric.mod.jsonManifest spec: mandatory fields, entrypoints, dependencies, version rangescore-fabric-mod-json
Fabric LoomGradle plugin: DSL options, dependency configurations, tasks, production runscore-loom
Mappings & MigrationYarn vs Mojang mappings, 26.1 unobfuscation, migrateMappings/Ravelcore-mappings-and-migration
EventsListening to Fabric API events, loot table modification, custom eventscore-events
NetworkingCustom payloads, StreamCodecs, sending/receiving, PlayerLookupcore-networking
Text & TranslationsComponents, translatable text, serialization, ChatFormattingcore-text-and-translations
Testing & DebuggingFabric Loader JUnit, game tests, CI, logging, breakpoints, crash logscore-testing-and-debugging
Key Mappings & Game RulesKeyMappingHelper, client tick reactions, custom game rulescore-key-mappings-and-game-rules

Items

TopicDescriptionReference
First ItemRegistration, creative tab, name/texture/model/client itemitems-first-item
FoodFoodProperties and Consumable effectsitems-food
PotionsCustom potions and brewing recipesitems-potions
Spawn EggsSpawnEggItem registration and assetsitems-spawn-egg
Tools & ArmorToolMaterial, tools, ArmorMaterial, armor layers and equipment modelsitems-tools-and-armor
Item Models & AppearanceModel JSON structure, display transforms, custom tint sourcesitems-models-and-appearance
Creative TabsFabricCreativeModeTab builder and registrationitems-creative-tabs
Interactions & Enchantmentsuse/useOn overrides, custom enchantment effectsitems-interactions-and-enchantments
Data ComponentsCustom DataComponentType, composite components, tooltipsitems-data-components

Blocks

TopicDescriptionReference
First BlockRegistration with/without item, assets, loot tables, tool tagsblocks-first-block
Block States & ModelsProperties, blockstate JSON, model elements, tintingblocks-blockstates-and-models
Block EntitiesTypes, NBT save/load, client sync, tickers, BERsblocks-block-entities
Containers & MenusContainer/WorldlyContainer, menus, screens, workstationsblocks-containers

Fluids

TopicDescriptionReference
First FluidSource/flowing states, liquid block, bucket, tags, renderingfluids-first-fluid

Entities

TopicDescriptionReference
First EntityRegistration, goals, models, renderers, animations, synced dataentities-first-entity
AttributesCustom attributes, attach/read/modifyentities-attributes
Effects & DamageCustom mob effects, data-driven damage types, death messages, tagsentities-effects-and-damage

Sounds

TopicDescriptionReference
Playing & Custom SoundsSoundEvents, categories, volume/pitch, sounds.jsonsounds-using-and-custom
Dynamic SoundsClient SoundInstances: looping, tracking sources, transitionssounds-dynamic

Commands

TopicDescriptionReference
Commands & SuggestionsBrigadier basics, requirements, sub-commands, client commands, suggestionscommands-basics-and-suggestions
ArgumentsBuilt-in arguments, optional args, custom ArgumentTypecommands-arguments

Recipes

TopicDescriptionReference
Custom Recipe TypesRecipeInput, Recipe, serializers, recipe book hooks, syncrecipes-custom-types
Extending Vanilla RecipesSmithing/Crafting/Stonecutter recipe extensionsrecipes-extending-vanilla

Rendering

TopicDescriptionReference
Basic ConceptsBufferBuilder, vertex formats, matrices, quaternions, render pipelinesrendering-basic-concepts
GUI, Screens & WidgetsGuiGraphicsExtractor, scissor, textures/text, custom screens/widgetsrendering-gui
HUDHudElementRegistry, DeltaTracker partial ticksrendering-hud
World & ParticlesLevelRenderEvents, extraction/drawing phases, custom particlesrendering-world-and-particles

Data Generation

TopicDescriptionReference
Setupfabric-datagen entrypoint, Pack, providers, runDatagendatagen-setup
Models & TranslationsLanguage provider, block/item models, client itemsdatagen-models-and-translations
Server DataRecipes, tags, loot tables, advancements, enchantmentsdatagen-server
World GenerationConfigured/placed features, placement modifiers, biome modificationsdatagen-features

Serialization

TopicDescriptionReference
CodecsBuilding/composing/transforming codecs, dispatch, stream codecsserialization-codecs
Data AttachmentsAttaching synced/persistent data to entities/levels/chunksserialization-data-attachments
Saved DataLevel-scoped persistent data with SavedDataserialization-saved-data

Mixins & Class Tweakers

TopicDescriptionReference
JVM BytecodeDescriptors, LVT, operand stack, common instructionsmixins-bytecode
Accessors & Invokers@Accessor/@Invoker for fields, methods, constructorsmixins-accessors
Class TweakersAccess widening, interface injection, enum extensionclass-tweakers

Porting & Misc

TopicDescriptionReference
Porting & UpdatesVersion bumps, unobfuscation switch, Fabric API rename mapsporting-and-updates
Resource Conditions & StatsConditional loading, custom statisticsmisc-resource-conditions-and-statistics

Quick Reference

Minimal build.gradle (Minecraft 26.2)

plugins { id 'net.fabricmc.fabric-loom' version '1.16' }

dependencies {
  minecraft "com.mojang:minecraft:26.2"
  mappings loom.officialMojangMappings()
  modImplementation "net.fabricmc.fabric-api:fabric-api:0.155.2+26.2"
  implementation "net.fabricmc:fabric-loader:0.19.2"
}

loom {
  splitEnvironmentSourceSets()
  mods { "example-mod" { sourceSet sourceSets.main; sourceSet sourceSets.client } }
}

Minimal fabric.mod.json

{
  "schemaVersion": 1,
  "id": "example-mod",
  "version": "1.0.0",
  "entrypoints": {
    "main": ["com.example.ExampleMod"],
    "client": ["com.example.ExampleModClient"]
  },
  "depends": {
    "fabricloader": ">=0.19.0",
    "minecraft": "~26.2",
    "java": ">=25",
    "fabric-api": "*"
  }
}

Common Commands

./gradlew runClient        # dev run
./gradlew build            # build release JAR (build/libs)
./gradlew genSources       # decompile Minecraft sources
./gradlew runDatagen       # run data generation
./gradlew runClientGameTest # client game tests
./gradlew validateAccessWidener # validate class tweaker entries

Key API Notes

  • Registration: Registry.register(BuiltInRegistries.X, Identifier.fromNamespaceAndPath("mod", "name"), value).
  • 26.x uses Mojang names: Level (not World), BlockPos, ItemStack, Item.Properties, BlockBehaviour.Properties, FriendlyByteBuf.
  • Entrypoints: ModInitializer, ClientModInitializer, DedicatedServerModInitializer, DataGeneratorEntrypoint (fabric-datagen).
发现
标签

此技能尚未发布标签。

版本
最新版本元数据

版本

v2026.09.24

发布时间

Sep 24, 2026

分类

未分类

许可证

MIT

源路径

skills/fabric

默认分支

main

最新提交

4f463c7

Tree SHA

73bcd03