me.obsilabor.pistonmetakt.data.pistondata.PistonData.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of piston-meta-kt Show documentation
Show all versions of piston-meta-kt Show documentation
Kotlin library to interact with mojangs launchermeta and "piston-data" api
package me.obsilabor.pistonmetakt.data.pistondata
import kotlinx.serialization.Serializable
import kotlinx.serialization.json.Json
import kotlinx.serialization.json.JsonObject
import kotlinx.serialization.json.decodeFromJsonElement
import me.obsilabor.pistonmetakt.annotations.NotWorkingPistonMetaApi
import me.obsilabor.pistonmetakt.annotations.UnsafePistonMetaApi
@Serializable
data class PistonData(
val arguments: JsonObject? = null, // really scuffed and I don't know what a correct json scheme would look like
val assetIndex: AssetIndex,
val assets: String,
val complianceLevel: Int,
val downloads: Downloads,
val id: String,
val javaVersion: JavaVersion,
val libraries: List,
val logging: Logging,
val mainClass: String,
val minimumLauncherVersion: Int,
val releaseTime: String,
val time: String,
val type: String
) {
@UnsafePistonMetaApi
@NotWorkingPistonMetaApi
fun getUnsafeArguments(): LaunchArguments {
return Json.decodeFromJsonElement(arguments ?: throw RuntimeException("No arguments present"))
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy