Closed SanAndreaP closed 5 years ago
That should not be needed, just add back the AT that last Forge commit removed
hmmm... I tried that already and it didn't work (after executing gradlew clean -> gradlew cleanCache -> gradlew setupDecompWorkspace) I'll try again and see if I did anything wrong then.
urgh, I love gradle sometimes... I've deleted the .gradle folder in my user profile folder and now it works. New PR incoming.
I can't get it to work for some reason with the AT. After re-indexing the project it shows me the same errors again. The only field that gets transformed is the "reagent" field. I've attached an image to show how it works on my end. Maybe you have more luck with that, but I can't make a PR with errors in the project.
Hmm, I'll look into it. I wonder if the Forge patch somehow breaks the AT. If I cannot figure it out I'll comment back here and we will see about reflection.
I've looked into this more, and it seems the Forge patches are breaking the access transformer, so reflection is the only solution now. If you want to reopen this, feel free. Though, is there any reason you do not use ReflectionHelper like I did in utils? If there is a good reason, it might make sense to transition my other reflection to this method as well.
The only reason was I didn't know about it :V
I'll reopen, look into your ReflectionHelper and make appropriate changes to this PR when I get home.
I've updated this PR now. I still kept the ReflectionUtil, because there are 2 advantages to just using the ReflectionHelper:
I also added a fallback if the mod gets used on older Forge versions.
If you want I can look through the code, replace the rest of the ReflectionHelper usage with the Util class and make a separate PR.
Yeah, if you don't mind I'd prefer using the same reflection method everywhere. Either this PR or another. You can probably also remove the ATs, they are only needed if we directly access the fields.
It might be worth me switching to storing delegates rather than potion types as well, but that's an idea for another day.
Anyways, I'll add some more specific comments when I have a better chance to look at this.
updated PR again, with replacement of the ReflectionHelper occurences to ReflectionUtil
updated PR
method names are now in the right order and proper exceptions are now catched.
The silk touch method is now properly looked up via the Block class. I also added a way to lookup private classes and incorporated into the reflection stuff.
Alright, merged. Thanks!
Given that I couldn't get the Access Transformer to transform the class PotionHelper$MixPredicate to be public (it is package-private now), I resorted to using reflection. Shouldn't impact performance, as they only get accessed during load and the field references are cached.