Kotlin for Forge

Kotlin for Forge

70M Downloads

KotlinForForge with Ktor: Class not found

Icosider opened this issue ยท 3 comments

commented

Hi, i create a mod with using KotlinForForge and Ktor Client, but when i will be launch the game, game was crash with log:
crash-2023-04-18_13.58.35-fml.txt

build.gradle

ktor_version=2.2.4 <- in gradle.properties

dependencies {
    minecraft 'net.minecraftforge:forge:1.18.2-40.2.1'

    implementation "io.ktor:ktor-client-core:$ktor_version"
    implementation "io.ktor:ktor-client-cio:$ktor_version"
    implementation "io.ktor:ktor-client-okhttp:$ktor_version"
    implementation "io.ktor:ktor-client-content-negotiation:$ktor_version"
    implementation "io.ktor:ktor-serialization-kotlinx-json:$ktor_version"

    implementation "thedarkcolour:kotlinforforge:3.11.0"
}

Mod MainClass:

import io.ktor.client.*
import io.ktor.client.engine.okhttp.*
import io.ktor.client.plugins.*
import net.minecraftforge.fml.common.Mod

@Mod("webworker")
object WebWorker {
    val httpClient = HttpClient(OkHttp) {
        install(HttpTimeout) {
            connectTimeoutMillis = 5_000L
        }
    }
}
commented

It doesn't work if you use your library

commented

Come to Discord server I can help you more easily there