Skip to content
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

Refmap remapping on modlauncher in dev #462

Open
Barteks2x opened this issue Jan 20, 2021 · 9 comments
Open

Refmap remapping on modlauncher in dev #462

Barteks2x opened this issue Jan 20, 2021 · 9 comments

Comments

@Barteks2x
Copy link

Legacy FML agent has this code

private void injectRemapper() {
try {
MixinPlatformAgentAbstract.logger.debug("Creating FML remapper adapter: {}", MixinPlatformAgentFMLLegacy.FML_REMAPPER_ADAPTER_CLASS);
Class<?> clFmlRemapperAdapter = Class.forName(MixinPlatformAgentFMLLegacy.FML_REMAPPER_ADAPTER_CLASS, true, Launch.classLoader);
Method mdCreate = clFmlRemapperAdapter.getDeclaredMethod("create");
IRemapper remapper = (IRemapper)mdCreate.invoke(null);
MixinEnvironment.getDefaultEnvironment().getRemappers().add(remapper);
} catch (Exception ex) {
MixinPlatformAgentAbstract.logger.debug("Failed instancing FML remapper adapter, things will probably go horribly for notch-obf'd mods!");
}
}

and this allows remapping refmap to work. Modlauncher specific agent doesn't have an equivalent.

While this wouldn't allow mods using mixin to work in dev just by putting them into mods folder (because that's not supported at all), this should allow dependencies added with fg.deobf to work (since the dependency remaping uses this code https://github.com/MinecraftForge/InstallerTools/blob/9147fcae6e088daf02d31a01ce6724ce91361ffa/src/main/java/net/minecraftforge/installertools/SrgMcpRenamer.java#L99-L112 which would remap shadows and overwrites correctly).

@Mumfrey
Copy link
Member

Mumfrey commented Jan 20, 2021

You're right this was an oversight when I was making the modlauncher agent, I had intended to do this once I figured out what mapping provider is available in modlauncher or fml but it slipped my mind. Thanks for opening an issue, will look into this.

@BloCamLimb
Copy link

This can be solved by adding Java system properties,

minecraft {
    runs {
        client {
            property 'mixin.env.remapRefMap', 'true'
            property 'mixin.env.refMapRemappingFile', "${projectDir}/build/createSrgToMcp/output.srg"
        }
    }
}

then re-run genIntellijRuns and refresh gradle project

@gingershaped
Copy link

The fix @BloCamLimb suggested doesn't work for me, and I can't figure out why.

build.gradle: https://gist.github.com/GingerIndustries/03efeaed0b2ced30c648c9c33d00df3a

@gingershaped
Copy link

I may be listing Supplementaries as a dependency wrong.

@GaeaKat
Copy link

GaeaKat commented Mar 29, 2022

This can be solved by adding Java system properties,

minecraft {
    runs {
        client {
            property 'mixin.env.remapRefMap', 'true'
            property 'mixin.env.refMapRemappingFile', "${projectDir}/build/createSrgToMcp/output.srg"
        }
    }
}

then re-run genIntellijRuns and refresh gradle project

It seems you also need to add those properties to the other runs in 1.18.2 I don't know about earlier ones. without them runData for datagen purposes failed.

@BloCamLimb
Copy link

This can be solved by adding Java system properties,

minecraft {
    runs {
        client {
            property 'mixin.env.remapRefMap', 'true'
            property 'mixin.env.refMapRemappingFile', "${projectDir}/build/createSrgToMcp/output.srg"
        }
    }
}

then re-run genIntellijRuns and refresh gradle project

It seems you also need to add those properties to the other runs in 1.18.2 I don't know about earlier ones. without them runData for datagen purposes failed.

Yes, you're right. Generally, you should also apply these to server and data. But if you add MixinGradle plugin, you don't need these setups.

@0-x-2-2
Copy link

0-x-2-2 commented Apr 12, 2022

The fix BloCamLimb suggested doesn't work for me, and I can't figure out why.

It won't work correctly if they don't use the same mappings, but that may not be the issue here anyways but that is something to note.

@19Phin
Copy link

19Phin commented Mar 26, 2023

can someone please give tutorial to little mod author who can barely lambda how i can depend a mod that depends Architectury

@zml2008
Copy link
Member

zml2008 commented Mar 26, 2023

@19Phin Don't bump unrelated issues for your support query. I don't really see how that question is related to Mixin in the first place either -- you probably want to talk to the Architectury people or the original mod developer if anything.

@SpongePowered SpongePowered deleted a comment from 19Phin Mar 26, 2023
@SpongePowered SpongePowered locked as off-topic and limited conversation to collaborators Mar 26, 2023
@SpongePowered SpongePowered deleted a comment from 19Phin Mar 26, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

8 participants