Based on Compose-Runtime, library for creating declartive UI inside the inventory.
CanvasManager.canvas(player) {
var clicks by remember { mutableStateOf(0) }
slot(0, 0) {
itemStack(Material.STICK, amount = (clicks + 1).toByte()) { clicks++ }
}
}
CanvasManager.canvas(player) {
row(1) {
stick()
}
}
@Composable
fun RenderContext.stick() {
slot(0, 0) {
itemStack(Material.STICK)
}
}
Library depends on Minestom, KStom, and Compose-Desktop Runtime
To add compose runtime use the plugin jetbrains provides
// settings.gradle.kts
pluginManagement {
repositories {
gradlePluginPortal()
mavenCentral()
maven { url = uri("https://maven.pkg.jetbrains.space/public/p/compose/dev") }
}
}
// build.gradle.kts
plugins {
id("org.jetbrains.compose") version "0.3.0-build152"
}
repositories {
jcenter()
maven("https://maven.pkg.jetbrains.space/public/p/compose/dev")
}
dependencies {
implementation(compose.runtime)
}