Skip to content

Instantly share code, notes, and snippets.

@TheCurle

TheCurle/Info.md

Last active Jun 8, 2021
Embed
What would you like to do?
[ForgeGradle] Updating the old toolchains; a why, how, and where.

RetroGradle

RetroGradle is an initiative to update the older ForgeGradle toolchains (1.x to 2.3) and the Minecraft versions associated with them, to use the more modern ForgeGradles (3.x and 4.x).
To do that requires a lot of time and scripting, but nothing is "complex".

1.12

The update for 1.12 to the FG3 toolchain is the benchmark for how we're going to do the other versions.
The repo update itself can be found here. The largest change here is the build.gradle script. You'll notice that it looks almost identical to the 1.16.x buildscript, with a few minor differences.
Those being, the MCP version (we'll get to that), the run configs using legacydev.Main(Client/Server) rather than userdev.Main, and some other small adjustments to make 1.12 happy.

The other thing updated for 1.12 is this, the 1.12 MCPConfig export.

MCPConfig

MCPConfig is how Forge exports its metadata for specific versions. It contains all of the information necessary to take the vanilla Minecraft files, decompile it, and make it fully compatible with a Java compiler again.
This forms the base ("clean") files that Forge can later patch itself onto, when the time for building that comes along.

The MCPConfig export comes in four main parts; the patches, the exc, the tsrg and the config.

Handily, the team currently working on RetroGradle has made a tool to convert old versions' srg (not csrg) MCP zips, into folders compatible with the MCPConfig project. If you want to see how that works, see the readme

ForgeFlower

ForgeFlower is the name of a fork of the IntelliJ decompiler, which is called FernFlower.
Due to the fact that FernFlower and ForgeFlower are constantly evolving, the code that they output is also "unstable", meaning that some lines could be swapped, some lines missing altogether, etc, between one version of the decompiler and the next.

Because Forge is based upon patching code, and patch files require full context (meaning, they record the lines above and below the lines that actually change), we need to make sure that the decompiler is outputting exactly what MCPConfig and Forge are expecting to patch onto.

To do that, we need to identify the exact versions of the decompiler used by each version of ForgeGradle, convert them from their current form (which is either something like FernFlowerLegacy or fernflower-fix-1.0.zip) to a branch in the style of the current ForgeFlower repo.
To do this, we need to know the exact commit of upstream that the version is based on, as well as a list of the commit hashes (or a tool that was used to patch) on top of the base.

Then it's a simple matter of setting up, patching, and exporting the tool.

Helping

If you're interested in helping us, come to the Forge Discord server at https://discord.gg/UvedJ9m and hop into the #retrogradle channel. Curle and the rest of the RetroGradle team will guide you

This document will be expanded in the future.

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