-
-
Notifications
You must be signed in to change notification settings - Fork 23
Account for logical breaking change in ASMAPI.findFirstInstructionBefore() #56
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Account for logical breaking change in ASMAPI.findFirstInstructionBefore() #56
Conversation
It is INSANE to me that version info is somehow not exposed in either ForgeSPI or ModLauncher.
- Use FMLLoader to get the current version. If it's below 1.21.3, do not use the fixed logic by default - Add new methods that include a boolean parameter for fixing the logic. This overrides the behavior imposed by CoreMods to fix the logic based on MC version.
|
I've marked this PR as a draft for now as I haven't tested it yet. Feedback on the code would still be appreciated. |
|
As suggested by @PaintNinja, I've removed the soft-dependency on FMLLoader and am instead using ModLauncher's blackboard to arbitrarily tell CoreMods if it should not fix the bugged behavior. On all versions before Forge for 1.21.3, I will be sending this key to the blackboard. |
|
This PR is ready for merge. |
LexManos
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks fine to me
This was discussed in a large part over Discord (starting here). My fix for #35, implemented in #50, did not account for the possibility that older coremods could rely on the broken behavior of the old method.
Unfortunately, fixing this problem relies on getting the Minecraft version within CoreMods. Since CoreMods is not loaded before FMLLoader is, CoreMods now relies on FMLLoader as a soft-dependency in order to get version information. This version information is used to determine whether it should apply the fix to
ASMAPI.findFirstInstructionBefore()by default or not. I have made it so that the fix is applied by default on Minecraft 1.21.3 and later.Additionally, I've added two sister methods that have a boolean parameter,
fixLogic, to override this behavior. This allows for modders who still actively mod older versions to allow overriding the fix for themselves to benefit from the intended behavior of the method.