Adapt 26.1 Fabric metadata and mixin transformations - #2270
Closed
dominicbytes wants to merge 1 commit into
Closed
Conversation
Member
|
I'll be closing this PR as it introduces hardcoded mod-specific patches, which should be placed in an addon instead of connector itself. I've added a new Plugin API in Connector 26.1 beta 3 that allows for this, you can find a tutorial on our wiki. If there's anything that can be patched dynamically without hardcoding, please open a PR to Adapter. |
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
Several Fabric mods targeting Minecraft 26.1.2 fail during transformation or NeoForge startup because their metadata and mixin targets no longer correspond to the NeoForge runtime.
The failures fall into three categories:
Native dependency aliases are applied too late.
Origins: Legacy depends on the Fabric ID
cloth-config2, while native NeoForge Cloth Config providescloth_config. Connector's existing alias layer operates after Launchpad has converted the Fabric dependencies into NeoForge metadata, so NeoForge mod sorting rejects the dependency before the alias can take effect.Fabric enum extensions can conflict with NeoForge's extensible-enum mechanism.
Farmer's Delight Refabricated extends
RecipeBookTypethrough a Fabric class tweaker and mixin. NeoForge implements this enum asIExtensibleEnumand requires additions to be declared throughenumExtensionsmetadata instead of direct Mixin extension.Minecraft and NeoForge have moved or replaced several mixin target operations.
Origins, Farmer's Delight, and Debugify contain injectors targeting methods, fields, calls, constants, or local ordinals that changed in Minecraft 26.1.2 or NeoForge. These failures can be masked by earlier metadata errors, so they become visible only after the preceding problem is repaired.
The Proposal
This change adds narrowly scoped metadata and mixin adaptations for the affected 26.1.2 artifacts.
Native dependency aliases
depends,recommends,suggests,breaks, andconflicts.Farmer's Delight enum extension
For the exact Farmer's Delight
RecipeBookTypeextension, Connector:RecipeBookTypeconstant from the Fabric class tweaker.SearchRecipeBookCategoryenum extension intact.RecipeBookTypeMixinfrom the mixin configuration.META-INF/connector_enum_extensions.json.launchpad:enum_extensionscustom metadata property referencing that resource.The accompanying Launchpad change projects this property into NeoForge's
enumExtensionsmod metadata.Mixin adaptations
The explicit 26.1.2 method patches cover:
goDownInWaterselector.Blockto the NeoForgeBlockStateextension.createResultInternal.startSleepInBedlambda.growCroptoapplyBonemeal.ServerPlayerGameMode.destroyBlock.ServerPlayer.blockPosition.WoodTypemethods toFenceGateBlockfields.MonstertoMob.lookAtowner and ordinal change.dropAllDeathLoottodropEquipment.The fox handler is made self-contained by obtaining its
ServerLevelfrom the targetFoxinstead of capturing a target-method argument that no longer exists at the new location.Regression tests cover dependency alias behavior, Farmer's Delight enum conversion, and Debugify's shadow-field adaptation.
Possible Side Effects
Active dependency aliases now affect transformed metadata before NeoForge mod sorting. This is limited to aliases whose native provider is present. When no matching native mod is loaded, the original Fabric dependency remains untouched.
Changing active aliases also changes the transformation cache identity. This may cause an additional cold transformation when the installed native-mod set changes, but prevents a transformed JAR produced under one alias configuration from being incorrectly reused under another.
When both an alias and its native target are present in the same dependency section, their predicates are combined into an array. This preserves both constraints but may make the generated metadata more restrictive than either predicate alone.
The Farmer's Delight enum conversion is intentionally artifact-specific. It activates only for the
farmersdelightmod containing the expectedRecipeBookTypeMixin. Changes to that mod's package names, class tweaker, constant name, or mixin configuration may require this rule to be updated.The explicit mixin patches match particular target classes, methods, mixin types, constants, and injection points. A different mod using an identical combination could also match a rule, although the signatures are intentionally narrow.
One Debugify injection is disabled because NeoForge's replacement
hurtAndBreakpath already stops item use when the blocking item breaks. If NeoForge changes that behavior later, this equivalence should be reviewed.Alternatives
One alternative was to rely on Connector's existing Fabric Loader alias support. This was not sufficient because NeoForge dependency sorting occurs before that alias layer can satisfy Launchpad-generated metadata.
Another option was to require native-mod authors to provide every historical Fabric ID. That would move Connector-specific compatibility requirements into unrelated native mods and would not address existing releases.
Pre-patching the affected mod JARs was also considered. Maintaining separate patched distributions would make updates and provenance harder to manage and would bypass Connector's normal transformation pipeline.
The failing mixins could have been disabled wholesale. This was rejected where the handlers preserve meaningful behavior. Individual injections were disabled only when bytecode inspection showed that they were behavior-neutral or that NeoForge already supplied the same correction.
A generalized automatic conversion of every Fabric enum extension was not selected. Not all Fabric enum targets implement NeoForge's extensible-enum interface, and constructor parameters cannot always be inferred safely. The current conversion therefore handles only the verified Farmer's Delight case.
Additional Notes
This change depends on the accompanying Adapter and Launchpad changes:
bytecraft/connector-26.1.2-mixin-repairsbytecraft/enum-extension-metadataThe current dependency pins anticipate:
2.0.45+26.1.21.6.3+26.1.2These version numbers should be adjusted to the actual published versions before merge if the release numbers differ.
Validation completed successfully: