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

Cannot use Kotlin on forge-platform-specified side #135

Open
dayo05 opened this issue Jun 1, 2023 · 0 comments
Open

Cannot use Kotlin on forge-platform-specified side #135

dayo05 opened this issue Jun 1, 2023 · 0 comments
Labels
bug Something isn't working Forge This issue is specific to the Forge platform.

Comments

@dayo05
Copy link

dayo05 commented Jun 1, 2023

In forge execution task, classes inside the common-jar and forge platform-sided classes are loaded with setting the classpath in the argument.
When using non-java language(which also supports JVM) on forge platform-sided part, the built class files are not located on the forge/build/java/ and this causes the ClassNotFoundError when using those classes from Java source code or exceptions which related mod not loaded on set the entrypoint of the mod to those classes using like Kotlin For Forge.

To fix this problem (only to use Kotlin) temporary, you can add

tasks.runClient {
    classpath += project.files(File(projectDir, "build/classes/kotlin/main"))
}

tasks.runServer {
    classpath += project.files(File(projectDir, "build/classes/kotlin/main"))
}

this code into your gradle file(this code is for Kotlin DSL and you can use similar method in groovy code too.)

Using other languages in common part doesn't felt in this bug because it loads the dev.jar file which those classes are included. But if you @ExpectPlatform annotation, this bug will affect.
Also, using fully built jar file with external forge environment(official forge installation; multimc; etc.) will not affect to this bug because the problem is related to classpath, not remapping or creation of jar file.

I suggest to load devlibs in forge too or detect the languages(with finding the subdirectories of forge/build) and add classpath for them.

@Juuxel Juuxel added bug Something isn't working Forge This issue is specific to the Forge platform. labels Jun 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Forge This issue is specific to the Forge platform.
Projects
None yet
Development

No branches or pull requests

2 participants