ejektaflex / Kambrik

A Lightweight Kotlin-Fabric Library
https://kambrik.ejekta.io/
10 stars 4 forks source link

Incompatible with Inventorio mod #5

Closed phlafoo closed 2 years ago

phlafoo commented 2 years ago

Inventorio curseforge page

I needed Kambrik for the Bountiful mod. I had about 75 mods installed but I narrowed down a prelaunch entrypoint crash to an incompatibility with the Inventorio mod. Here is the crash log.

I was able to resolve the issue by simply removing the fabric.mod.json prelaunch entrypoint from Kambrik. After that I confirmed that Bountiful was working properly so I assume Kambrik is still functioning as well. I'm not sure why the prelaunch entrypoint is needed but I thought I would raise the issue here in case it is something you want to look into.

mod versions to replicate issue: fabric-api-0.40.1+1.17 fabric-language-kotlin-1.6.4+kotlin.1.5.30 inventorio-1.17-fabric-1.6.2 Kambrik-1.1.0

ejektaflex commented 2 years ago

This is the error:

Caused by: java.lang.LinkageError: loader net.fabricmc.loader.launch.knot.KnotClassLoader @6692b6c6 attempted duplicate class definition for kotlin.jvm.internal.Intrinsics

Kotlin is being loaded twice. This is because Inventorio is shadowing the Kotlin JAR files and using their own versions instead of depending on Fabric Language Kotlin. As such, ANY Kotlin mod that also uses Fabric Language Kotlin (there are a lot) may be prone to crash when used with Inventorio.

This is unfortunately something that they need to fix, by switching to Fabric Language Kotlin (which is the recommended way to use Kotlin alongside Fabric - this avoids nested Jars, which is what they are doing.)

Lizard-Of-Oz commented 2 years ago

Inventorio does not include a copy of Fabric Kotlin by itself, it has to be installed separately. The shadowing line mentioned in @ejektaflex response appears to be unrelated to the bug. It's how Inventorio's package for fabric (or forge) includes the common package.