Silk Compose is a module for SilkMC which makes it possible to use Compose Multiplatform inside Minecraft, both on the server- and the client-side (the latter only planned).
silk-compose-demo.mp4
Silk Compose is available on Maven Central.
modImplementation("net.silkmc:silk-compose:$version")
Download silk-compose from Modrinth to provide it at runtime and add it as a mod.
The docs are located at silkmc.net/silk-compose/docs.
To display a basic UI for a player, do the following:
player.displayComposable(8, 6) {
YourComposableFunction()
}
@Composable
fun YourComposableFunction() {
var clicks by mutableStateOf(0)
Button(
onClick = { clicks++ }
) {
Text("Clicked $clicks times")
}
}