OptiFabric — OptiFine on Fabric
A Fabric mod that brings OptiFine to Fabric. Put OptiFabric and your own OptiFine 1.20.6 jar into mods/ and it takes care of the rest.
ℹ️ OptiFine is not bundled or redistributed. Get OptiFine 1.20.6 from the official site (only preview builds exist for 1.20.6 so far).
Why it is needed
OptiFine is built for vanilla (and Forge): its patches are compiled against the official obfuscated names, while Fabric runs in the intermediary namespace. Fabric API also injects into many of the same classes. Put together, the two disagree in ways that are hard to diagnose — different constructor shapes, different synthetic field names, helper methods inlined away, object creation replaced by OptiFine's own subclasses, and so on.
What it does
At the earliest point of startup (the loader's preLaunch), OptiFabric will:
- run OptiFine's own installer to extract its patches for the game classes;
- drop the volde-ification and remap the patches from official to intermediary;
- repair the known structural conflicts between OptiFine and Fabric API (each one traced down to the bytecode level);
- hand the repaired classes to the Fabric Loader's class transformer and cache the result under
<game dir>/.optifine/<version>/, so later launches reuse it instead of doing the work again.
Installation
- Install a 1.20.6 client with Fabric Loader 0.19.3 or newer.
- Put OptiFabric and your own OptiFine 1.20.6 jar into
.minecraft/mods/. The file is named likepreview_OptiFine_1.20.6_HD_U_J1_pre18.jar— dropping it in is enough, you do not need to run its installer first. - Start the game. The OptiFine version appears in the top left of the title screen when it works.
Fabric API can be loaded alongside (this port is adapted for it specifically).
Requirements
| Minecraft | 1.20.6 |
| Fabric Loader | 0.19.3 or newer |
| Java | 21+ (tested on Java 25) |
| Side | client |
| Optional | Fabric API (supported) |
Compatibility issues that are fixed
All of these were found through real crashes and traced to the bytecode:
- Fabric API's
ShaderProgramMixininjected beforesuper()→ OptiFine's delegating constructor is rewritten; - fields OptiFine left obfuscated with a mismatching descriptor (e.g. the particle factory table) → realigned by name, type and stored value;
- private helpers OptiFine inlined away while recompiling → the vanilla method body is restored so injections have a target again;
- methods OptiFine turned into forwarders to its own overloads (chunk building, model baking) → vanilla bodies restored (this was behind "every model fails to bake" and invisible blocks);
- object creation OptiFine redirects to its own subclass (the
ChunkOFchunk object) → an inert marker puts the injection point back; - a ported fixer dropped a field initialisation together with the constructor it replaced → the constructor is no longer replaced (this one disconnected multiplayer sessions after two seconds).
The full list (symptom / cause / fix) is in the changelog.
Known issues
- Conflicts with Sodium — both are renderers; do not install them together.
- Incompatible with RyoamicLights — OptiFine replaces the whole video settings screen (including its superclass), which makes that mod's injection fail and crashes as soon as the screen is opened. OptiFine has built-in dynamic lights (Video Settings → Quality → Dynamic Lights), so it is not needed.
- Mods that rely on FRAPI/indigo no longer get indigo's custom rendering; terrain is rendered by OptiFine.
- OptiFine cannot see resources inside Fabric mods — you will see
Unknown resource pack type: ...ModNioResourcePackin the log. This is a limitation on OptiFine's side. - Shader packs that do not match your OptiFine version log
[Shaders] Invalid program name: ...; that comes from the shader pack.
Troubleshooting
Where is the cache / how do I force a rebuild? <game dir>/.optifine/<OptiFine version>/. Delete the .optifine/ folder to force a rebuild.
Why can't I find [OptiFabric] in the log? Its output goes to the launcher console, not to logs/latest.log.
The game jar cannot be found / I want to point at it manually Add -Doptifabric.mc-jar=<path to the vanilla 1.20.6 client jar>.
I want to inspect the patched classes Add -Doptifabric.extract=true; the remapped OptiFine classes are unpacked to .optifine/<version>/optifine-classes/.
Reporting a problem
Please attach:
logs/latest.log(plus the matching file fromcrash-reports/if it crashed — it ends with an-- OptiFabric --section listing the OptiFine version, jar status and remapped jar path);- your
mods/folder listing; - your OptiFine version (e.g.
OptiFine_1.20.6_HD_U_J1_pre18).
License and credits
A port of Chocohead/OptiFabric by Modmuss50 and Chocohead, licensed under MPL-2.0.