MinimallyCorrect / ModPatcher

Allows easy patching of mods/plugins/arbitrary minecraft classes using config files
MIT License
8 stars 6 forks source link

Clarification/Minor Help #17

Open DarianLStephens opened 6 years ago

DarianLStephens commented 6 years ago

If I'm understanding this correctly, this mod would allow us to remove, add, or replace arbitrary sections of code in classes, without having to compile anything in java? (I've had zero luck setting up a forge dev environment, so this would be a great alternative for modifying existing classes) If so, I'm going to go through the Minecraft bug reports and trying to apply some of those fixes! The problem here is that there doesn't seem to be any documentation on this whatsoever; the best place to get it appears to be the source. Just a list of the possible function names (insertBeforeCode, whatever else there may be...) would be a great help to getting this going. As it stands, it looks like I need to either guess the functions or find them in the source, and I don't know how long the latter would take.

LunNova commented 6 years ago

The methods available for xml patches are here:

https://github.com/nallar/JavaPatcher/blob/master/src/main/java/me/nallar/javapatcher/patcher/Patches.java

There's some javadoc there.

I'm not working on the XML patching system, for future development mixin patches will be preferred. So I won't be updating/improving documentation for it. Mixin patches wouldn't help you as they need a working dev environment.

Forge's dev environment shouldn't be too hard to get working. Install JDK 8. Set JAVA_HOME environment variable to JDK 8 path. Clone forge. .gradlew setupForge. Done.

DarianLStephens commented 6 years ago

As long as the XML/JSON system works in 1.7.10 with the methods listed there, I'll be okay for now. See, I've done that, but then when I try to open it in git it says it's not a valid git environment or something. I don't know, it's frustrating.

DarianLStephens commented 6 years ago

Alright, so... I've been having trouble understanding just how to use it. I've been trying to remove the limit on mushroom spreading, but I haven't been able to figure out how to target the right section of code. I have tried many variations, but it usually says something to the effect of 'No method found in BlockMushroom.class'. I believe the simplest way to do so would be to replace 'int l = 5;' with 'int l = 50;' or some equally high number, so it never reaches zero, but I'm not sure, because the source is mostly a lot of numbers and letters. Do you suppose I could have a few working examples of removing a section of code, inserting a section of code after a specific section, and possibly replacing a section, if that's much different from just removing a bit and adding another after the line just before?