neoforged / NeoGradle

Gradle plugin for NeoForge development
GNU Lesser General Public License v2.1
40 stars 24 forks source link

Alternative for `minecraftLibrary` #12

Closed henkelmax closed 8 months ago

henkelmax commented 9 months ago

There does not seem to be an alternative for minecraftLibrary in NG7. Is there any way to get libraries working in the development runtime?

Technici4n commented 9 months ago

Does implementation not work?

henkelmax commented 9 months ago

Does implementation not work?

No, it complains about all classes from the libraries missing when trying to run the game.


EDIT:

Same for gradle sub projects like shown here

https://github.com/neoforged/MDK/blob/ab3c7e49df21e46f5d316added8e1c5afc334ee0/build.gradle#L100

I only get subprojects to get included on the runtime when doing

tasks.withType(JavaCompile).configureEach {
    source(project(':otherproject').sourceSets.main.allSource)
    ...

This does not seem to work

runs {
    client {
        modSource project(':otherproject').sourceSets.main
        ...
SquidDev commented 9 months ago

implementation doesn't work because the classes only end up on the classpath, but they actually need to end up on the Minecraft classpath (defined by the legacyClassPath.file system property) (thanks bootstrap launcher)

Historically this could be done by overwriting the minecraft_classpath token (which is what minecraftLibrary did under the hood, which was then used to generate the classpath file.

However, minecraft_classpath is entirely gone now. Generation of the classpath file is done by UserDevRuntimeDefinition, which doesn't appear to be accessible from build scripts (and uses a temporary configuration, so definitely isn't suitable here anyway).

MommyHeather commented 9 months ago

This hurts my ability to do stuff too, I'd love to see a fix asap really, as I'm not sure I can properly port - I mean, I'd love for my IDE to be able to test, even though this doesn't affect runtime for me.

Technici4n commented 8 months ago

This should be addressed by #52.