Skip to content

Add VirtualJar for generated packages#54

Merged
marchermans merged 2 commits intoMcModLauncher:mainfrom
Technici4n:virtual-jar
Nov 23, 2023
Merged

Add VirtualJar for generated packages#54
marchermans merged 2 commits intoMcModLauncher:mainfrom
Technici4n:virtual-jar

Conversation

@Technici4n
Copy link
Copy Markdown
Contributor

This will let frameworks like mixin define additional packages in the GAME layer for runtime generated classes with the following additional code in a transformation service:

    @Override
    public List<Resource> completeScan(final IModuleLayerManager layerManager) {
        try {
            return List.of(
                    new Resource(IModuleLayerManager.Layer.GAME, List.of(
                            new VirtualJar(
                                    "mixin_generated_classes",
                                    Path.of(getClass().getProtectionDomain().getCodeSource().getLocation().toURI()),
                                    Constants.SYNTHETIC_PACKAGE,
                                    Constants.SYNTHETIC_PACKAGE + ".args"))));
        } catch (URISyntaxException e) {
            throw new RuntimeException(e);
        }

Fixes McModLauncher/modlauncher#90. Tested with a forgedev @ModifyArgs mixin :)

Co-authored-by: Matyrobbrt <65940752+Matyrobbrt@users.noreply.github.com>
@marchermans marchermans merged commit 67e23de into McModLauncher:main Nov 23, 2023
@Technici4n Technici4n deleted the virtual-jar branch November 23, 2023 13:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow registering additional packages in the transformable layer for generated classes

3 participants