shedaniel / cloth-config

Client-Sided API for Minecraft 1.14
Other
194 stars 72 forks source link

Error: duplicate fabric loader for cloth-config v6.1.48 #251

Open kaz-mighty opened 6 months ago

kaz-mighty commented 6 months ago
minecraft_version=1.19
yarn_mappings=1.19+build.4
loader_version=0.15.10

#Fabric api
fabric_version=0.58.0+1.19

(Also occurs in 1.19.2)

If you specify the dependencies as per the wiki, the following error will occur when running Minecraft Client in IntelliJ IDEA.

Exception in thread "main" java.lang.ExceptionInInitializerError
    at net.fabricmc.loader.impl.launch.knot.KnotClient.main(KnotClient.java:23)
    at net.fabricmc.devlaunchinjector.Main.main(Main.java:86)
Caused by: java.lang.IllegalStateException: duplicate fabric loader classes found on classpath: jar:file:/C:/Users/kazuki/.gradle/caches/modules-2/files-2.1/net.fabricmc/fabric-loader/0.15.10/3538922fb4094a9d600d528e7acccac662b8a3c2/fabric-loader-0.15.10.jar!/net/fabricmc/loader/api/FabricLoader.class, jar:file:/D:/Users/kazuki/Minecraft_dev/MoreTooltips/.gradle/loom-cache/remapped_mods/net_fabricmc_yarn_1_19_1_19_build_4_v2/net/fabricmc/fabric-loader/0.14.8/fabric-loader-0.14.8.jar!/net/fabricmc/loader/api/FabricLoader.class
    at net.fabricmc.loader.impl.util.LoaderUtil.verifyClasspath(LoaderUtil.java:65)
    at net.fabricmc.loader.impl.launch.knot.Knot.<clinit>(Knot.java:347)
    ... 2 more

This doesn't seem to happen if I set the dependencies as below:

    modApi("me.shedaniel.cloth:cloth-config-fabric:${project.cloth_config_version}") {
        exclude(group: "net.fabricmc.fabric-api")
        exclude(group: "net.fabricmc", module: "fabric-loader")
    }

Or change modApi to modImplementation.

This did not happen with 1.18.1 + cloth-config v6.1.48 and 1.19.4 + 10.1.117.

Jab125 commented 6 months ago

Not really a bug, more of how Gradle resolves dependencies.

If you see an error like trying to load net.fabricmc.loader.impl.FabricLoaderImpl from target class loader, it means you have two copies of Fabric Loader on your runtime classpath. Try adding { exclude group: 'net.fabricmc', module: 'fabric-loader' } after the affecting dependencies