thedarkcolour / KotlinForForge

Makes Kotlin forge-friendly.
GNU Lesser General Public License v2.1
187 stars 26 forks source link

KotlinForForge with Ktor: Class not found #68

Closed Icosider closed 1 year ago

Icosider commented 1 year ago

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
        }
    }
}
thedarkcolour commented 1 year ago

Use https://github.com/MinecraftForge/ForgeGradle/wiki/Dependencies#non-minecraft-dependencies

Icosider commented 1 year ago

It doesn't work if you use your library

thedarkcolour commented 1 year ago

Come to Discord server I can help you more easily there