Skip to content

Instantly share code, notes, and snippets.

@Earthcomputer
Created April 27, 2019 14:34
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Earthcomputer/fbebf91092af2f422721710d160a1134 to your computer and use it in GitHub Desktop.
Save Earthcomputer/fbebf91092af2f422721710d160a1134 to your computer and use it in GitHub Desktop.
Comparison of whether CarpetMod should be a Jar Mod or a Fabric Mod

I'm going to attempt to give a fair comparison of how well CarpetMod would work as a Jar Mod vs a Fabric Mod in the future, then give my opinion at the end.

Jar Mods

Jar Mods are what the 1.12 and 1.13 versions of CarpetMod currently are. They basically work by us directly modifying vanilla classes directly. Quick rundown of the process that isn't too in-depth: in order for us to do this, we must first translate the bytecode which Java executes into readable source code that we can understand and edit. This process is called "decompilation". Then, after we have edited the classes, we translate the code back into back into bytecode which Java can execute ("recompilation"). We then distribute parts of the code we have made changes to. Recompilation is very trivial and is unlikely to contain any errors at all. Although we use the best decompiler that exists (ForgeFlower), decompilation is still not 100% accurate.

Fabric Mods

QuickCarpet for 1.14 is a Fabric Mod. Fabric Mods are loaded by a mod loader called Fabric Loader, and CarpetMod can modify vanilla code through the use of "Mixins". To oversimplify a lot so this isn't too in-depth: we still decompile the code like with Jar Mods, but purely for the purposes of us being able to read and understand it. We then write Mixins which are instructions to Fabric of how to modify the original bytecode; however as coders we still don't usually have to think in terms of bytecode when writing Mixins, like we used to for older Mixin equivalents. The Fabric Loader itself makes 2 modifications to the vanilla code, but are purely for the purposes of loading mods, and they don't change the game at all. We are unlikely to use the Fabric API if we go for this option, which is different and has a chance (albeit still very unlikely) of changing behaviour.

Comparison

Jar Mods Fabric Mods
Difficulty for coders to modify vanilla Easy Moderate
Difficulty to use for code digging Easy Hard
Difficulty for users to install Moderate Easy
Compatibility with other mods Unlikely Compatible
Possibility to modularize CarpetMod Impossible Easy
Speed to update to new versions Weeks-Months Hours-Days
Possibility to support several versions at once Hard Moderate
Risk of decompiler changing behaviour Low Non-existent
Legal issues Grey area No problem

My Opinion

I think CarpetMod should be a Fabric Mod for the reasons above.

@liach
Copy link

liach commented Apr 30, 2019

Modifying vanilla isn't that hard. You can copy paste vanilla classes to your fabric mod so that classloader load your version instead of vanilla version of that class.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment