I've got a bunch of experience with programming, but not so much with modding minecraft. I used MCP to decompile the source of minecraft 1.12.2, then I made my desired modifications and recompiled it. I tested my modifications and they seem to have been succesful. It was nothing special, I just altered the behaviour of the rabbit entity a bit.
According to the readme, I have to obfuscate the lot, so that's what I did and now I have a bunch of .class files.
Next step would be to make this modded version accessable through the launcher and here I get stuck. In the readme of MCP they say:
- Your obfuscated classes are now available in "reobf\minecraft" and "reobf\minecraft_server", ready to be injected in MC.
- Make sure to delete the META-INF folder in minecraft.jar, otherwise the game will just black-screen when you start it.
When I insert these new classes in the 1.12.2.jar file inside %appdata%/.minecraft/versions/1.12.2 and remove the META-INF folder, I am supposed to be set. However, when I go into my launcher and launch my 1.12.2 profile(I tried both 'latest release' and just '1.12.2'), it downloads a new 1.12.2 and overwrites my modifications.
How am I supposed to create a profile that launches my minecraft with my modifications?
I've done some google searching, but all the information is rather confusing. Some talk about Forge, some about Modloader and they are all rather unfamiliar to me and I don't know which one I should take. I want to keep things simple preferably. Basically I want to be able to share my mod with a friend who is not technical at all and make sure that he's able to install and use my mod as well.
You have to make a copy of the 1.12.2 folder (inside of the versions folder) and rename it as well as the jar and json files inside, using the same name for eveything. Then, open the json and search for "id": "1.12.2" and change "1.12.2" to the same name you used, and then search for "client.jar", which will be part of a URL and delete the "downloads" section enclosing it, as seen below (as it happens, both of the things you need to change are right next to each other. Note that you delete everything seen here except for the last line):
Also, if you plan to distribute the mod you should include a modified json so you only need to replace the vanilla json since editing it is one of the most difficult steps (I do this for my own mod; you just have to copy/rename the version, replace the json, and add the mod as you'd normally do. Also, if you update the mod or use a different one you can just change the jar without having to do any of these steps again).
You could also use a 3rd party launcher; I have never used it but it appears that Magic Launcher (and probably others) lets you simply select a jar mod to use and it will automatically add it to the game when you launch it, making it as simple as using a Forge mod (no need to manually install it).
There is also some way to install a custom profile, as is done with mod installers like the ones that Optifine and Forge use, but I'm not sure how they work and they may just do all of the above automatically in addition to editing launcher_profiles.json (I don't think that manual installation is that difficult; as noted above, you can reuse a modded version by simply replacing or updating the jar so subsequent changes are much easier; updates in particular can simply be done by adding new files to the jar (as long as you did not un-modify any classes; for example, while updating my mod I've moved a lot of my code into my own classes which extend (previously modified) vanilla classes and leaving the original ones in can cause bugs or crashes).
Thank you very much TheMasterCaver! I have followed your instructions and it works like a charm. Adding an additional launch profile turned out to be very easy as well: I just created a new profile with a fixed version using the launcher gui and then I went into the launcher_profiles.json and changed the version to the name of my custom version.