Line 9: |
Line 9: |
| When setting up the environment for the first time, a gradle refresh triggers three things: | | When setting up the environment for the first time, a gradle refresh triggers three things: |
| # ForgeGradle downloads the MCPConfig zip for the file you're using, and triggers the SetupMCP task. | | # ForgeGradle downloads the MCPConfig zip for the file you're using, and triggers the SetupMCP task. |
− | # After that, it processes the jar - applies access transformers, MCPCleanup and others | + | # After that, it processes the jar - applies access transformers, side stripper and others |
− | # Finally, it patches and finalises the code, ready for modder consumption. | + | # Finally, it patches and finalizes the code, ready for modder consumption. |
| | | |
| == Needed knowledge == | | == Needed knowledge == |
Line 33: |
Line 33: |
| Each obfuscated class, method, and field is assigned a unique number by the [[Toolchain:MCPConfig|backend]], via a sequential counter. This unique number is called the '''SRG ID''' of that class/method/field (henceforth called member). | | Each obfuscated class, method, and field is assigned a unique number by the [[Toolchain:MCPConfig|backend]], via a sequential counter. This unique number is called the '''SRG ID''' of that class/method/field (henceforth called member). |
| | | |
− | The SRG name of the member is then derived from its SRG ID, its type (function {given the prefix <code>func_</code>}, field {given the prefix <code>field_</code>}, or parameter {given the prefix <code>p_</code>, or <code>p_i</code> if this is the parameter of a constructor}), and (optionally) the obfuscated name of the object at the time it was given its SRG name<ref>The SRG name for a given member is only created once, when it first appears in the code. Therefore, the SRG postfix may be different from the current obf name.</ref>. This inclusion of the SRG ID into the name guarantees that the SRG name for all members are unique, and is the reason the ID is generated. | + | The SRG name of the member is then derived from its SRG ID and its type (method {given the prefix <code>m_</code>}, field {given the prefix <code>f_</code>}, or parameter {given the prefix <code>p_</code>}). <ref>The SRG name for a given member is only created once, when it first appears in the code.</ref>. This inclusion of the SRG ID into the name guarantees that the SRG name for all members are unique, and is the reason the ID is generated. |
| | | |
− | The actual conversion of obf names to SRG names is done by a tool called [[Toolchain:SpecialSource|SpecialSource]]. More information on how it works can be found on that page. | + | The actual conversion of obf names to SRG names is done by a tool called [[Toolchain:Vignette|Vignette]]. More information on how it works can be found on that page. |
| | | |
| == The Setup == | | == The Setup == |
Line 47: |
Line 47: |
| | | |
| === Download and parsing MCPConfig === | | === Download and parsing MCPConfig === |
− | The first thing that ForgeGradle does upon initialising a first-time setup, is starting the [https://github.com/MinecraftForge/ForgeGradle/blob/e2ed49546abced95650635f81be071441ec60995/src/mcp/java/net/minecraftforge/gradle/mcp/task/SetupMCPTask.java#L91 SetupMCP] task. | + | The first thing that ForgeGradle does upon initializing a first-time setup, is starting the [https://github.com/MinecraftForge/ForgeGradle/blob/a0d2d1f488b3285ef7c75367feeebbe1a38aa19b/src/mcp/java/net/minecraftforge/gradle/mcp/tasks/SetupMCP.java#L74 SetupMCP] task. |
| | | |
− | This task then seeks to [https://github.com/MinecraftForge/ForgeGradle/blob/e2ed49546abced95650635f81be071441ec60995/src/mcp/java/net/minecraftforge/gradle/mcp/task/DownloadMCPConfigTask.java#L78 download the MCPConfig.zip jar] for the version you're setting up. | + | This task then seeks to [https://github.com/MinecraftForge/ForgeGradle/blob/a0d2d1f488b3285ef7c75367feeebbe1a38aa19b/src/mcp/java/net/minecraftforge/gradle/mcp/tasks/DownloadMCPConfig.java#L68 download the MCPConfig.zip jar] for the version you're setting up. |
| Once it is acquired, it | | Once it is acquired, it |
− | [https://github.com/MinecraftForge/ForgeGradle/blob/e2ed49546abced95650635f81be071441ec60995/src/mcp/java/net/minecraftforge/gradle/mcp/util/MCPRuntime.java#L74 parses the steps contained within the config.json]. It does this by interpreting the file with the following rules: | + | [https://github.com/MinecraftForge/ForgeGradle/blob/a0d2d1f488b3285ef7c75367feeebbe1a38aa19b/src/mcp/java/net/minecraftforge/gradle/mcp/util/MCPRuntime.java#L75 parses the steps contained within the config.json]. It does this by interpreting the file with the following rules: |
| * Every key, except for libraries, is interpreted as the name of a step. | | * Every key, except for libraries, is interpreted as the name of a step. |
| * Steps are executed in order. | | * Steps are executed in order. |
Line 60: |
Line 60: |
| ** java -jar <version> <args> <jvmArgs> | | ** java -jar <version> <args> <jvmArgs> |
| | | |
− | An example config.json can be found [https://github.com/MinecraftForge/MCPConfig/blob/master/versions/release/1.16.4/config.json here]. | + | An example config.json can be found [https://github.com/MinecraftForge/MCPConfig/blob/master/versions/release/1.17.1/config.json here]. |
| | | |
| It defines the steps: | | It defines the steps: |
− | * [[Toolchain:MCinjector|mcinjector]]
| |
− | ** version: de.oceanlabs.mcp:mcinjector:3.8.0:fatjar
| |
− | ** args: --in {input} --out {output} --log {log} --level=INFO --lvt=LVT --exc {exceptions} --acc {access} --ctr {constructors}
| |
| * [[Toolchain:ForgeFlower|fernflower]] | | * [[Toolchain:ForgeFlower|fernflower]] |
− | ** version: net.minecraftforge:forgeflower:1.5.478.16 | + | ** version: net.minecraftforge:forgeflower:1.5.498.12 |
| ** args: -din=1 -rbr=1 -dgs=1 -asc=1 -rsy=1 -iec=1 -jvn=1 -isl=0 -iib=1 -log=TRACE -cfg {libraries} {input} {output} | | ** args: -din=1 -rbr=1 -dgs=1 -asc=1 -rsy=1 -iec=1 -jvn=1 -isl=0 -iib=1 -log=TRACE -cfg {libraries} {input} {output} |
| ** jvmargs: -Xmx4G | | ** jvmargs: -Xmx4G |
| * [[Toolchain:Mergetool|merge]] | | * [[Toolchain:Mergetool|merge]] |
− | ** version: net.minecraftforge:mergetool:1.1.1:fatjar | + | ** version: net.minecraftforge:mergetool:1.1.3:fatjar |
− | ** args: --client {client} --server {server} --ann {version} --output {output} --inject false" | + | ** args: --client {client} --server {server} --ann {version} --output {output} --inject false |
| * [[Toolchain:MCInjector|rename]] | | * [[Toolchain:MCInjector|rename]] |
− | ** version: net.md-5:SpecialSource:1.8.3:shaded | + | ** version: net.minecraftforge.lex:vignette:0.2.0.10 |
− | ** args: --in-jar {input} --out-jar {output} --srg-in {mappings} | + | ** args: --jar-in {input} --jar-out {output} --mapping-format tsrg2 --mappings {mappings} --fernflower-meta --cfg {libraries} --create-inits --fix-param-annotations |
− | ** repo: https://repo1.maven.org/maven2/
| |
| | | |
| More information about each of these tools can be found at the link provided, as well as what each of these arguments do. A brief description is provided. | | More information about each of these tools can be found at the link provided, as well as what each of these arguments do. A brief description is provided. |
| + | |
| + | = TODO UPDATE BELOW = |
| | | |
| === MCInjector === | | === MCInjector === |