Skip to content

Instantly share code, notes, and snippets.

@williewillus
Created January 22, 2017 04:57
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save williewillus/6bb6fe89cb34b7df159091176ba90da4 to your computer and use it in GitHub Desktop.
Save williewillus/6bb6fe89cb34b7df159091176ba90da4 to your computer and use it in GitHub Desktop.
how to port a mod

Only half-serious, as opposed to 3/4 serious. Take of it what you will.

  1. Update your gradle and mappings. Get it wrong because you forgot to add the branch name.
  2. Commit so you feel good about taking the first step
  3. Rerun setupDecompWorkspace, refresh Gradle project in your IDE.
  4. Try to compile the mod and cry after seeing the error count
  5. Easy renaming time. If a class (or method/field with distinct name) has been renamed, just do a global find/replace. Congrats, you just added 10000 lines to the diff. Commit.
  6. Easy method signature time. If a method has changed arguments, say to add a hand parameter, just do a global find/replace. You DID name your parameters properly, not p_10101101010_xxx, right? ... Oho, you're going to have fun. Commit.
  7. Easy semantic stuff. This is stuff like changing x y z args to BlockPos, ForgeDirection to EnumFacing, etc. Commit per change.
  8. Missing methods. If something you override from vanilla is no longer there, first check the bot to see if it got renamed (!mh). Next, open up a workspace of the old version. Do a find usages on the old method, and see where it was called from in vanilla. Go to the same spot in the new version. What gets called instead?
  9. Repeat 8 on all non-rendering packages, going package by package.
  10. If the version hop you're doing changes rendering significantly, comment all your rendering out. Otherwise, fix it to compile
  11. Shake fist angrily at your dependencies that haven't ported.
  12. Port the dependencies (restart at 1) or comment all your integration out.
  13. Try to launch. See it crash.
  14. Fix all your rendering (lol)
  15. MOST IMPORTANT STEP: FIND ANY CODE YOU COPIED FROM VANILLA. Did you document where it came from and what you changed? No? Well that sucks. Go do it. This is a big reason why some mods lag behind more and more each update, they carry around massive amounts of ancient code from old versions of the game. Every time you copy from vanilla it should be a clean, diff-able copy of the original, with detailed notes of what you changed and why. So when a new versions comes out, you can just copy the new vanilla code in, and apply your own changes on top. Example: https://github.com/Vazkii/Botania/blob/1.11/src/main/java/vazkii/botania/common/item/equipment/tool/ToolCommons.java#L139-L160
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment