Support no-refmap method patches and ModifyConstant injectors#12
Open
dominicbytes wants to merge 1 commit into
Open
Support no-refmap method patches and ModifyConstant injectors#12dominicbytes wants to merge 1 commit into
dominicbytes wants to merge 1 commit into
Conversation
Su5eD
requested changes
Jul 16, 2026
Member
There was a problem hiding this comment.
This test needs to be documented.
Please also add a new DynamicMixinPatchTest test with a real-world example or equivalent under testClasses.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The Issue
Adapter currently skips method transformations when it cannot resolve the mixin's clean target method. This prevents explicitly configured compatibility patches from running for Fabric mods that omit a usable refmap, even when the patch precisely matches the mixin annotation and supplies the required replacement.
Adapter also lacks a mixin model for
@ModifyConstant. As a result, these injectors cannot be adapted when their target method moves between Minecraft and NeoForge. Integer constants are not represented byConstantData, further limiting constant-injector matching.Finally, the method-patch API cannot independently modify an injector's
ordinaland its nested@At.ordinal. These are separate annotation properties and may both require adjustment after target bytecode changes.These limitations were encountered while adapting Origins: Legacy to Minecraft 26.1.2 through Connector.
The Proposal
This change expands Adapter's generic method-patching capabilities:
ModifyConstantMixinmodel and registers@ModifyConstantas a supported mixin type.ConstantData.TARGET_CONSTANThas been inherited.ordinaland nested injection-point@At.ordinal.@ModifyConstantrecognition and simultaneous injector/injection-point ordinal changes.Explicit patches still have to match their configured target class, target method, mixin type, and other supplied annotation properties.
Possible Side Effects
Explicit manual patches can now run in cases where no clean target method is available. A stale or overly broad manual patch could therefore be attempted where Adapter previously returned early.
This risk is limited by the existing patch matcher and dirty-configuration validation. The fallback applies only when an explicitly registered patch matches; automatic resolution behavior remains unchanged when no manual patch is present.
Registering
@ModifyConstantmeans these injectors now enter the normal Adapter processing pipeline instead of remaining unsupported. This may expose existing constant injectors to transformations that were previously skipped.No material performance impact is expected. The additional matching and configuration work occurs only during mod transformation.
Alternatives
One alternative was to implement each affected transformation as a mod-specific bytecode rewrite in Connector. This was not selected because missing
@ModifyConstantsupport and independent ordinal editing are general Adapter capabilities that can benefit other Fabric mod adaptations.Another option was to generate or fabricate refmap information for mods that do not provide it. That would introduce inferred mapping data and could cause Adapter to select an incorrect clean target.
Disabling the affected mixins was also considered. This would allow startup in some cases but could remove intended mod behavior and produce a false compatibility result.
A final alternative was to retarget only the affected methods without adding a
@ModifyConstantmodel. That would not provide the configuration and parameter handling required to transform constant injectors safely.Additional Notes
Validation completed successfully: