Skip to content
Вернуться в блог
Java code showing @ExpectPlatform annotation for cross-loader Minecraft mod development

Architectury API: Write Minecraft Mods for Every Platform

ice
ice
@ice
Updated
51 просмотров
TL;DR:Architectury API lets mod developers write code once and deploy across Fabric, Forge, and other Minecraft loaders. Learn how this Java library abstracts platform differences and simplifies multiplatform mod development.
🐙 Open-source Minecraft project

architectury/architectury-api

An intermediary api aimed at easing development of multiplatform mods.

⭐ 420 stars💻 Java📜 LGPL-3.0
View on GitHub ↗

Tired of writing separate mods for Fabric and Forge? Architectury API lets you write your code once and deploy it across multiple loaders without duplicating half your project. It's the framework that turns multiplatform modding from a frustrating chore into something actually practical.

What This API Does

Architectury API isn't just another library. It's a translation layer between two fundamentally different ways of modding Minecraft.

Picture this: You've built a brilliant mod for Forge. Then someone asks if it works on Fabric. Turns out it doesn't, because Forge and Fabric implement core systems completely differently, and you've woven loader-specific code throughout your project. You're now staring at months of rewrites to get the same mod working on another platform.

That's the exact problem Architectury solves. But it provides a unified interface so your mod can call into whichever loader it's running on without caring about the differences underneath. Forge has different code than Fabric? Architectury handles that for you. The project provides over 90 event hooks and abstractions for registries, networking, and loader detection. You're not reimplementing the entire API landscape, but rather getting a sensible translation layer that speaks both languages fluently.


Why Mod Developers Want This

Here's the brutal truth of old-school multiplatform modding: you'd build your mod, test it, fix bugs, add features... and then do it all over again for the other loader. Every bug fix needed to land in two places. Every new feature meant double work. Most modders just picked one platform and called it a day.

With Architectury, you keep shared code in a common module and tuck platform-specific stuff into separate folders. Most of your logic lives once and works everywhere. That's genuinely powerful when you're maintaining a mod over months or years. But it also means you're not choosing between communities. Some players prefer Fabric loaders (especially Quilt), others stick with Forge. Check out the server list on minecraft.how and you'll see multiplayer communities using wildly different modpacks, each with their own loader preferences. By supporting multiple platforms, you're reaching both audiences instead of leaving one stranded.


The @ExpectPlatform Annotation: How It Works

The README mentions this annotation, but here's what actually happens under the hood.

Suppose you need to call something that's implemented differently on Fabric versus Forge. Maybe screen rendering, maybe event handling, maybe network packets. You can't just call both. Folks who try this don't know at compile time which loader you're running on.

Architectury's answer: the @ExpectPlatform annotation. Mark a method with it, and you're telling the build system, "This method will have different implementations depending on the platform." Your shared code calls it normally. Behind the scenes, the build process swaps in the right version for each loader. Fabric users get the Fabric implementation, Forge users get Forge. Clean.

It's elegant because your common code stays readable while you handle platform differences exactly where they exist, nowhere else.


Beyond Annotations: Events, Networking, Registries

@ExpectPlatform is powerful, but Architectury doesn't stop there.

Event systems are huge. Fabric and Forge both have them, but they're architecturally different. Architectury abstracts both so you register event listeners without platform-specific branching. Item registry differences? Covered. Networking between client and server? Same treatment. One thing worth noting: you don't have to use all of this. Architectury is optional even in a project built with their toolchain. You can use just the build setup and handle differences yourself if you want. But if you're already here, why not use the event hooks and utilities they've already written? Saves time.


What You Need to Get Started

Here's where people get confused.

Architectury API by itself isn't sufficient. You need three pieces working together. First is the Architectury Plugin, a Gradle plugin that sets up your project structure and tells the build system how to juggle platform differences. Second is Architectury Loom, a fork of Fabric Loom that adds multiplatform build capabilities (think decompilation, remapping, dev environment management). Third is looking at the official templates on their GitHub to understand the actual folder structure and Gradle configuration.

The ecosystem sounds heavy, but it's actually less overhead than maintaining two separate mod projects. Shared development, shared code, shared testing, only platform-specific code lives apart.


Common Things That Trip New Modders Up

You can't just bolt Architectury onto an existing single-platform mod. Most players need to restructure your project using their toolchain. It's not insurmountable, but it's not zero work either.

@ExpectPlatform only works on static methods. That's a real constraint if you're used to instance-based approaches. It makes sense (static methods are easier to swap at build time), but it's good to know upfront.

Testing becomes more complex. You need to actually test both loaders, ideally across multiple Minecraft versions. Your CI setup needs to handle this. Solo modders often skip full testing, which is why some mods claim multiplatform support but actually work noticeably better on one platform than the other.


Do You Need This?

For a quick experimental mod, probably not. Single-platform development is faster. But once you've got something real with features that don't care which loader is underneath, Architectury saves enormous time.

If your mod is deeply tied to platform-specific features, or you're only targeting one loader, skip it. You'll be happier and faster. The sweet spot: you've got a solid mod idea, you want to reach the widest possible player base, and you don't want to maintain two entirely separate codebases. That's when Architectury earns its place in your build.


Alternative Approaches Worth Considering

Quilt Standard Library is another cross-platform option, though it leans harder toward Quilt compatibility than Architectury's broader multi-loader focus.

Some modders use processor annotations or Mixins to handle platform differences without a dedicated abstraction. More work, but you keep maximum control. And honestly, if you're only ever targeting Forge or only Fabric, you don't need Architectury at all. Use your platform's native APIs and skip the abstraction layer entirely. There's no shame in single-platform development if that's your goal.


The Real Value Proposition

If your modding ambitions extend beyond one loader, Architectury is time well spent. Here's the thing, the project is actively maintained, the community is helpful (their Discord is linked on GitHub), and the solution actually works at scale.

Building multiplatform mods without it is like managing separate DNS configurations manually instead of using a tool - technically possible, but why? The tooling exists to save you from unnecessary complexity. A Minecraft modding ecosystem is thriving across multiple loaders. Architectury makes participating in that ecosystem practical instead of exhausting.

Frequently Asked Questions

Do I need Architectury API if I only care about Forge or Fabric?
No. Architectury API is specifically for multiplatform development. If you're targeting only one loader, use that loader's native APIs directly. The abstraction layer adds complexity with no benefit if you don't need multiple platforms.
Is Architectury API free to use?
Yes, completely free and open source under the LGPL-3.0 license. The entire ecosystem (plugin, API, loom) is maintained by volunteers. You can use it commercially without fees.
Can I convert an existing mod to use Architectury?
Theoretically yes, but practically it's significant work. You'd need to restructure your project, separate platform-specific code, and rewrite portions for the abstraction layer. Most developers find it easier to start fresh with Architectury than retrofit an existing mod.
What Minecraft versions does Architectury API support?
Architectury API updates regularly and supports recent Minecraft versions. The project tracks the latest releases. Check their GitHub releases page and Discord for version-specific support. Different versions of the API target different Minecraft versions.
Does using Architectury API slow down my mod?
No, it shouldn't noticeably impact performance. The abstraction happens at build time (mostly), and the runtime overhead is minimal since Architectury just delegates to the platform's native implementation. Any performance difference is negligible compared to your actual mod code.