Skip to content

Instantly share code, notes, and snippets.

@Earthcomputer
Last active October 16, 2022 14:03
Show Gist options
  • Save Earthcomputer/afe6f6da5eb8d93a2cb4aec453d6b912 to your computer and use it in GitHub Desktop.
Save Earthcomputer/afe6f6da5eb8d93a2cb4aec453d6b912 to your computer and use it in GitHub Desktop.
How to make mods for 1.13

Decompiling

  1. Clone MCPConfig from the GitHub repository.
  2. In the root project directory, run gradlew :1.13:projectClientApplyPatches if you want to make a client side mod, or gradlew :1.13:projectServerApplyPatches if you want to make a server side mod.
  3. Naviage into versions/1.13/projects/server (or client). There are a couple of fixes necessary to get the code to compile:
    1. There is a missing class mcp.MethodsReturnNonnullByDefault which you will have to manually add. A copy can be found here.
    2. If you're making a server-only mod, the anonymous classes in net.minecraft.item.ItemClock and net.minecraft.item.ItemCompass need to be modified to override the method in net.minecraft.item.IItemPropertyGetter. This is never actually called on the server so you can make a dummy implementation.
  4. Copy versions/1.13/projects/server (or client) into a separate project folder so you still have a clean copy of 1.13.
  5. TODO: convert mappings from SRG to MCP (optional).
  6. Inside the new project folder you created, run gradle eclipse to work in Eclipse, or gradle idea to work in intellij. For this you need to have Gradle installed.

Import this project into your IDE and start modding. To test out your mod you only need to launch in the normal way the IDE provides.

Recompiling

  1. Once you're done, run gradle build inside your modded project directory. This produces a JAR inside build/libs.
  2. Also run gradlew build in the unmodified project directory (versions/1.13/projects/server) and note the produced JAR inside build/libs.
  3. Get a SpecialSource JAR if you haven't already
    1. Clone SpecialSource from its GitHub repository.
    2. In the SpecialSource directory run mvn package. This requires you to have Maven installed.
    3. You will find the built SpecialSource JAR in target/SpecialSource-1.8.5-SNAPSHOT-shaded.jar.
  4. Create reverse mappings using my python script in the same directory as joined.tsrg. This will create a new file called reversed.tsrg.
  5. Run SpecialSource on each of the unmodded and the modded server JARs, using the following command: java -jar SpecialSource.jar --in-jar path/to/server.jar --out-jar path/to/obf.jar --srg-in path/to/reversed.tsrg
  6. Filter out only the modified classes using my python script. It takes three arguments, the unmodified obfuscated JAR, the modified obfuscated JAR and the output JAR that will contain only the modified classes.
  7. Rename the output JAR to something more presentable, and you're ready to distribute!
@Earthcomputer
Copy link
Author

@sqbi-q hi, the method in this gist is very outdated and there are automated methods now. Your best bet is to check out an old 1.13 revision of my repository https://github.com/Earthcomputer/jarmod-buildsystem-2.

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