lilmods / kotlin-minecraft-mod-template

A Kotlin Minecraft mod template. Supports both forge & fabric. Includes github CI & CD. Includes cloth config / mod menu. Uses gradle kts and is multi module
The Unlicense
3 stars 0 forks source link

[forge] kotlin std classes can not be loaded during runtime #2

Closed lilgallon closed 1 year ago

lilgallon commented 1 year ago

Minecraft crashes with ClassNotFoundException

There is an issue with https://github.com/thedarkcolour/KotlinForForge. The kff jar includes the kotlin dependencies, I don't understand why it crashes in runtime

lilgallon commented 1 year ago

The problem appears when the kotlin core code is executed.

Tried a lot of things:

It works well for fabric, I don't know what forge is doing under the hood... I don't know if it's a design issue of KFF or Forge or Both

lilgallon commented 1 year ago

I got it working by adding the core module sourceSet to forge

lilgallon commented 1 year ago

Kotlin for forge shades the kotlin stdlib instead of "jar-in-jaring" it. So the forge module can not depend on an external non-mod library that depends on kotlin stdlib. The only way to fix the conflict would be to depend on kotlin for forge in the common module. Which is something I really don't want.

It's being tracked there: https://github.com/MinecraftForge/MinecraftForge/issues/8878