A multiloader (Forge + Fabric) example showing how to use Access Wideners — a single
.accesswidener file that widens access to protected/private Minecraft members, working across
both loaders on obfuscated MC 1.20.1 (the hardest case: Forge → SRG runtime, Fabric → intermediary runtime).
aw/multiloader-1.20.1/
├── build.gradle # accessWidener = "${mod_id}.accesswidener" on all loader modules
├── common/ # shared code calls DedicatedServer.initServer() (widened)
├── forge/ # AW→AT by Mavenizer, runtime test via ServerAboutToStartEvent
│ └── src/main/resources/multiloader_test.accesswidener
├── fabric/ # AW consumed natively by Fabric Loader, fabric.mod.json reference
│ └── src/main/resources/fabric.mod.json ("accessWidener": "multiloader_test.accesswidener")
│ └── src/main/resources/multiloader_test.accesswidener
└── gradle.properties
The same .accesswidener file (v2 named format, Mojang namespace) is placed in each loader
module's resources:
accessWidener v2 named
accessible class net/minecraft/server/dedicated/DedicatedServer
accessible method net/minecraft/server/dedicated/DedicatedServer initServer ()Z
- ForgeGradle resolves the AW from the source set and passes
--access-widenerto the Mavenizer (0.5.32+) - The Mavenizer converts the AW to an Access Transformer (
.cfg) with SRG names using the Mojmap→SRG mapping generated by MCPConfig. The conversion happens insideaccessTransform()— after MCPConfig has finished, so the SRG file is always available on the first build.public ahe (DedicatedServer → ahe in SRG) public ahe e()Z (initServer → e()Z in SRG) - The converted AT is merged with any existing ATs and applied to the Minecraft jar during deobfuscation
- The mod compiles against the widened jar —
initServer()is now accessible
- The AW file is included in the jar's resources (from the source set)
fabric.mod.jsonreferences it:"accessWidener": "multiloader_test.accesswidener"- At dev time, the Mavenizer does NOT convert it (Fabric handles AWs natively at runtime)
- At runtime, the Fabric Loader reads the AW from the jar and applies the widening
The accessWidener property is on the minecraft extension (parallel to accessTransformer):
minecraft {
mappings channel: 'official', version: mc_version
accessWidener = "${mod_id}.accesswidener" // resolves from src/main/resources/
}It follows the same convention cascade as accessTransformer: the loader modules can override
it per-dependency, and the default path is META-INF/${mod_id}.accesswidener.
./gradlew build
# forge/build/libs/multiloader_test-forge-1.0-srg.jar # Forge ship (SRG prod)
# fabric/build/libs/multiloader_test-fabric-1.0-intermediary.jar # Fabric ship (intermediary prod)| architectury-loom | ForgeGradle 7 (this fork) | |
|---|---|---|
| AW→AT conversion | Gradle task (Aw2AtAction) runs during jar build |
Mavenizer CLI converts during MC deobfuscation |
| AT ships in the jar | Yes (AT .cfg bundled in mod jar) |
No (AT baked into MC dev jar, mod doesn't need it at runtime) |
| Namespace origin | AW is in named (Mojmap), AT in SRG |
Same |
| Factory handling | AW is optional per-loader via architectury.common.json |
AW declared in minecraft extension DSL, applies to all Forge/NeoForge deps |