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

Can't run NeoForge's dataGen with Architectury Loom #259

Open
Craftjakob opened this issue Dec 27, 2024 · 2 comments
Open

Can't run NeoForge's dataGen with Architectury Loom #259

Craftjakob opened this issue Dec 27, 2024 · 2 comments

Comments

@Craftjakob
Copy link

Using Architectury Loom 1.9
I am always using the newest Minecraft, Fabric and NeoForge version.

In Architectury Loom 1.7 everything worked fine, but now I can't build a project with this version. :c

When running runData with this configuration:
build.gradle : neoforge

loom {
    neoForge {
        runs {
            data {
                data()
                programArgs '--mod', '--all', "${mod_id}"
                programArgs '--output', project(':common').file('src/generated/resources').getAbsolutePath()
                programArgs '--existing', project(':common').file('src/main/resources').getAbsolutePath()
            }
        }
    }
}

build.gradle : main

allprojects {
    sourceSets {
        main.resources.srcDirs = ['src/main/resources', 'src/generated/resources']
    }
}

This error occurs:

Exception in thread "main" java.lang.ClassNotFoundException: [Forge] Main class has not been determined yet!
	at java.base/java.lang.Class.forName0(Native Method)
	at java.base/java.lang.Class.forName(Class.java:421)
	at java.base/java.lang.Class.forName(Class.java:412)
	at net.fabricmc.devlaunchinjector.Main.main(Main.java:85)
	at dev.architectury.transformer.TransformerRuntime.main(TransformerRuntime.java:220)
warning: dev-launch-injector in pass-through mode, parsing failed: java.io.IOException: invalid attribute: dataServerArgs

I know there is also an clientData() and serverData(), but there it says:

Exception in thread "main" java.lang.NullPointerException
	at java.base/java.util.Objects.requireNonNull(Objects.java:233)
	at java.base/java.util.ImmutableCollections$List12.indexOf(ImmutableCollections.java:597)
	at java.base/java.util.ImmutableCollections$AbstractImmutableList.contains(ImmutableCollections.java:331)
	at MC-BOOTSTRAP/[email protected]/net.neoforged.fml.loading.ImmediateWindowHandler.load(ImmediateWindowHandler.java:49)
	at MC-BOOTSTRAP/[email protected]/net.neoforged.fml.loading.ModDirTransformerDiscoverer.earlyInitialization(ModDirTransformerDiscoverer.java:42)
	at MC-BOOTSTRAP/[email protected]/cpw.mods.modlauncher.TransformationServicesHandler.lambda$discoverServices$17(TransformationServicesHandler.java:125)
	at java.base/java.lang.Iterable.forEach(Iterable.java:75)
	at MC-BOOTSTRAP/[email protected]/cpw.mods.modlauncher.TransformationServicesHandler.discoverServices(TransformationServicesHandler.java:125)
	at MC-BOOTSTRAP/[email protected]/cpw.mods.modlauncher.Launcher.run(Launcher.java:83)
	at MC-BOOTSTRAP/[email protected]/cpw.mods.modlauncher.Launcher.main(Launcher.java:74)
	at MC-BOOTSTRAP/[email protected]/cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:26)
	at MC-BOOTSTRAP/[email protected]/cpw.mods.modlauncher.BootstrapLaunchConsumer.accept(BootstrapLaunchConsumer.java:23)
	at cpw.mods.bootstraplauncher.BootstrapLauncher.run(BootstrapLauncher.java:210)
	at cpw.mods.bootstraplauncher.BootstrapLauncher.main(BootstrapLauncher.java:69)
	at net.fabricmc.devlaunchinjector.Main.main(Main.java:86)
	at dev.architectury.transformer.TransformerRuntime.main(TransformerRuntime.java:220)

I haven't found any solutions on the Architectury documentation and Discord.

When I'am looking where the problem is, I see in the RunConfigSettings.class this:

public void forgeTemplate(String templateName) {
        ModPlatform.assertForgeLike(this.getExtension());
        this.defaultMainClass("[Forge] Main class has not been determined yet!");
        this.evaluateNowOrLater(() -> {
            ForgeRunsProvider runsProvider = this.getExtension().getForgeRunsProvider();
            ForgeRunTemplate template = (ForgeRunTemplate)runsProvider.getTemplates().findByName(templateName);
            if (template != null) {
                template.applyTo(this, runsProvider.getResolver(this));
            } else {
                this.project.getLogger().warn("Could not find Forge run template with name '{}'", templateName);
            }

        });
    }
@Craftjakob Craftjakob changed the title Can't run NeoForge's dataGen Can't run NeoForge's dataGen with Architectury Loom Dec 27, 2024
@Jab125
Copy link
Member

Jab125 commented Dec 28, 2024

is this 1.21.4? NeoForge changed how datagen worked on neoforge, see their blog post and this architectury loom commit. Either clientData() or serverData() might work, but if it doesn't then #258 might fix that

@Craftjakob
Copy link
Author

I do it like in the NeoForge post, but it does not work. And yes it is the 1.21.4, always the newest.

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

No branches or pull requests

2 participants