silk-compose

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).

Demo

silk-compose-demo.mp4

Dependency

Development Environment

Silk Compose is available on Maven Central.

modImplementation("net.silkmc:silk-compose:$version")

As a normal user

Download silk-compose from Modrinth to provide it at runtime and add it as a mod.

Usage

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")
    }
}

GitHub

View Github