-
Notifications
You must be signed in to change notification settings - Fork 13
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
Error when calling vanilla or Forge classes from dependency library in kotlin environment #51
Comments
I'm facing the same problem. I fixed it temporarily by putting the dependency source code in the build/rfg/minecraft-src folder. However, this is a bad way, because the decompiled dependency source contains errors. Maybe you managed to solve this problem in a better way during these 2 months? |
Same problem. Wasn't happening before to me IIRC, I've been using RFG earlier with Kotlin without problems :I |
@slava110 |
Have a look at https://github.com/GTNewHorizons/MX-Random/blob/master/addon.gradle - it builds with latest RFG using the GTNH buildscript without issues and is a kotlin mod. |
And if that doesn't help, please send a code sample or repository I can actually test to see what's going on |
well… is that project using RFG? i couldn’t find any reference in *.gradle files |
Yes, almost all GTNH projects use RFG. We now switched to GTNHGradle which uses RFG as a dependency, but you can look at the old buildscript here https://github.com/GTNewHorizons/MX-Random/blob/8a6903997e9c34e991f607554d179367c3d8d3b6/build.gradle |
Can i use GTNHGradle for MC1.12.2? |
@eigenraven I've created minimal reproducible example here: |
Any updates on this, found any workarounds? |
|
Try run |
I did run it, does not help |
If anything,
I don't think any of these would practically matter, but that's probably the only outstanding points also can you build the project by running gradlew build? |
Yes, the project builds just fine, also if I access the library from java, it works just fine (without no warnings/errors), so it is related to how IDEA handles Kotlin I think. Will check the other stuff and let you know if that helps |
Did not help, rolled back to 2023.3.6, java 17, gradle 8.6. |
https://github.com/eigenraven/MinecraftDev as opposed to the one you would find on plugin marketplace |
How about gradlew clean and delete .idea folder (while IDE is closed of course)? |
Still have the same problem. I tried different Kotlin (1.8.22 — 1.9.23) + Gradle (8.2 — 8.7) + system-wide JDK (1.8 — 21), and nothing helped. The problem can be solved in bad way, to decompile the .jar dependency and to put its classes into rfg/minecraft-src. But you know, the quality of decompiled dependencies is low. |
@Hummel009 @Glease |
I also filled out an issue on the JetBrains YouTrack as it might be an issue on their end: https://youtrack.jetbrains.com/issue/IDEA-352220/Cannot-access-class-net.minecraftforge.fml.common.event.FMLServerStartingEvent.-Check-your-module-classpath-for-missing-or |
Yes, compiler K2 works perfect with retrofuturagradle. Thanks! |
With the release of Kotlin 2.0, the error did not disappear on its own (although the developers report that the compiler is now used by default). Apparently, the “K2 Mode” checkbox does something different. So we'll have to wait a while longer before everything works as it should. Because at the moment, unfortunately, enabling this checkbox breaks a lot of other plugins. |
Example:
Error Message:
Cannot access class 'net.minecraft.item.ItemStack'. Check your module classpath for missing or conflicting dependencies
The text was updated successfully, but these errors were encountered: