What Is Mixin? Minecraft Bytecode Modding (2026)

Mixin is the bytecode-injection library that lets Minecraft mods patch the game's classes at load time. Here is what it does and why mods need it.

Frameworksby trqUpdated June 4, 2026
Key takeaways
  • Mixin is a Java library that patches Minecraft's compiled classes at load time.
  • Mods describe where to inject code, not what the file looks like, so patches survive game updates.
  • Fabric is built on Mixin and applies each mod's mixins during class loading.
  • You never install Mixin yourself; the loader bundles it.

Mixin is a Java library that lets a mod patch Minecraft's compiled classes while the game loads, without editing the original source. Mods write small classes that say "add this code at this point in this game method," and Mixin weaves them into the bytecode at runtime. Fabric uses it as its core modding mechanism.

Where Opal fits

Opal is a Fabric mod, so it builds on Mixin under the hood. You do not install Mixin yourself; the setup guide covers getting Opal and Fabric running.

How Mixin works

Mixin edits classes after they compile but before the JVM runs them. A mod ships a mixin class that targets a real game class. Annotations on that class mark where the injected code goes: the start of a method, the end, a specific method call, or a returned value. When Minecraft loads the target class, Mixin rewrites its bytecode to splice in the mod's code.

This matters because Minecraft is not designed to be extended. The game has no official plugin points for most behavior. Mixin gives mods a way in by treating the compiled game itself as the extension surface.

Why mods use it instead of editing the game

Two reasons: compatibility and updates.

Editing the game's source directly means shipping a whole modified copy, which nobody else can build on and which breaks the moment the game updates. Mixin patches are small and surgical, so many mods can patch the same game without each shipping a full fork.

The patches also describe where to inject rather than what the file looks like, so a mixin written against one version often still applies after a game update, as long as the target method still exists.

How it fits with Fabric

Fabric is built on Mixin. The loader reads each mod's mixin config, then hands the listed mixin classes to Mixin so they apply during class loading. A typical Fabric mod is mostly its own classes plus a handful of mixins that hook the few game methods it needs to change.

Common injection points

AnnotationWhat it does
@InjectRuns your code at a chosen point inside a target method
@RedirectReplaces a specific method call inside the target
@ModifyArgChanges an argument passed to a call inside the target
@ModifyVariableRewrites a local variable mid-method
@OverwriteReplaces a whole method (last resort; breaks easily)

@Inject is the default tool because it is the least invasive and the most likely to survive a game update. @Overwrite is avoided because it clashes with any other mod touching the same method.

FAQ