Skip to main content

Vincent's Website

Fabric Experience Report with Patchouli

In the past week, I’ve been working on an unofficial port of Patchouli from Forge 1.14 to Fabric 1.15.

My reasons for this are twofold:

  1. People have made claims about Forge’s problems, both with its technical aspects and its organizational aspects (some of which I feel), and pushed Fabric as a solution
  2. Making a judgment on X vs Y is invalid if you haven’t used both X and Y

Anyways, Patchouli, for those who don’t know, is a guide book mod by Vazkii for Forge. It allows guide books to be created using json files, and is what underlies the critically acclaimed Lexica Botania in 1.14. It was chosen for this experiment because it’s relatively small (compared to Vazkii’s other content mods), yet is still a real-world use case. Note however, it’s not a realistic representation of the “average mod” – most of the mod is made of GUI’s and book loading logic, there’s only one item, and there’s no blocks.

Positives:

  1. gradle tools work and are fast – launching a dev environment does not need an internet connection (looking at you, FG3)
  2. Mixins are extremely simple and easy to use – it took referencing some of Fabric-API and RebornCore’s code, but I was able to grasp it completely within a day. Compare that to manipulating ASM by hand, shudder.
  3. event system is simple and optimized for performance (no event objects are allocated on the fire-path)
  4. Insanely fast porting and updating time due to the incremental per-snapshot approach
  5. Friendly community and leadership – all my questions in #mod-dev were answered promptly and politely. When I started talking about this port in Discord, one of the developers asked me for my thoughts and criticisms. At first, I didn’t think it mattered much, but nowadays it’s a bit disappointing when you see that 80% of the Discord messages from your community’s project leader are rants or insults. I did notice a lot of undue Mojang-bashing and circlejerking in the Fabric #mod-dev channel though.
  6. Higher bus-factor in the development pace – no waiting for weeks because the two people who can update MCP are gone.

Negatives

  1. core API’s are still fairly thin. Forge gets flak for being bloated and monolithic, which makes it slow to update, but what you have to realize is all of the API’s in Forge were put in for a reason: enough people needed it.
  2. discoverability is extremely low. This is probably my biggest gripe in my week using Fabric so far. With Forge’s patching approach, changes made to vanilla are visible in the decompiled source in IDE, whereas in Fabric, looking at a piece of vanilla code does not indicate in any way what Mixins apply and at what points. You have to hunt around in your libraries for the appropriate mixins or higher level API’s (e.g. events)
  3. combination of #1 and high modularity means the ecosystem is still in lots of churn, and from passively lurking in #mod-dev on Discord I get the sensation that we’re still in the wild west in terms of discovering best practices, and I have a feeling some of the lessons learned will be re-traced steps on a path the Forge community has already walked.
  4. #3 means that there are often multiple different competing implementations of certain API’s, making compatibility a potential issue
  5. Writing JVM descriptors in Mixins is very annoying with long argument lists, but thankfully the Mixin runtime helpfully points out any errors and fails fast.

Observations

  1. fabric is simple, in that it opts to stay as close to vanilla as possible. Vanilla’s systems are extended in straightforward and natural ways, instead of being replaced wholesale. For example, Forge often patches out entire vanilla methods, but in Fabric-world the corresponding mechanism, Mixin @Overwrite, is frowned upon.
  2. I am curious to see whether the fast update pace can be maintained as Fabric and its surrounding ecosystem grow larger.
  3. Most of my time was spent handling the 1.15 rendering changes from 1.14, and remapping from MCP to Yarn (surprisingly, I had to make fewer renames than I expected).
  4. The core logic of the mod remained essentially untouched, only the points where the mod interfaces with the loader or minecraft itself (e.g. events) had to be changed. Forge events either became Fabric event handlers, or a Mixin when no Fabric alternative was available, and the loading process had to be adapted to Fabric’s entry point system. Overall, it was much less work than I expected, but only because the core of Patchouli is quite portable between the two loaders. The same probably can’t be said for large Forge mods like Botania.
  5. I ended up with 7 client mixins and 3 common mixins, which seemed like a lot for a small-medium sized mod like this.

Verdict

If the core API’s and the ecosystem are fleshed out, yet remain modular and quick to port, Fabric will present an, in my opinion, technically superior alternative to Forge. Of course, this is predicated on the ecosystem maturing to that point, which will undoubtedly take a while. I’ve always said that the number one barrier to Fabric’s adoption is not technical, it’s the entrenchment of Forge. Modders want their mods to be available where the most players are available and where other big mods are available. This feedback loop is the hardest bump to get over. Projects like Patchwork I hear are attempting to implement Forge API’s on top of Fabric, but I am mildly skeptical of how effective it’ll be for large mods, which are the ones that need the most work to migrate.

Hopefully, this report is useful to members of the Forge community that have not interacted with Fabric and members of the Fabric community interested in what a Forge modder for the past 4 years has to say.


The code for Fabric 1.15 port of Patchouli is here. There are still some lingering issues and hacky implementation and I welcome experienced Fabric modders to help me make things more idiomatic. (Although most of the issues are 1.15-related and not exclusive to Fabric.)

If and when that happens, it’ll be released as an unofficial project on Curse. It will support only the latest stable Minecraft that Fabric itself supports. The Forge version will remain the primary source of truth and changes will be ported over.

No, do not ask about Fabric Botania or Fabric <large Vazkii content mod>. It’ll happen if and when it happens. However, we humbly request that you not try to port any of them yourself. The license does not forbid from doing so, but we’d rather be in control of any Fabric ports that happen. At least contact us first.