Fancy™ kotlin syntax for oωo-lib
Pros | Cons |
---|---|
Greater flexibility | Limited support for oωo-lib features |
Fancy™ syntax | Updates arrive later than oωo-lib |
Uses kotlin | Performance slightly lower than oωo-lib |
Setup
In your build.gradle
file, add these lines:
repositories {
maven { url "https://api.modrinth.com/maven" }
}
dependencies {
modImplementation include("maven.modrinth:kowo-lib:0.12.10+1.21")
// only if you plan to use owo-config
// annotationProcessor "io.wispforest:owo-lib:0.12.10+1.21"
}
Example usage
class ButtonTestScreen : BaseKowoScreen<FlowLayout>() {
override fun createRoot(horizontalSizing: Sizing, verticalSizing: Sizing): FlowLayout {
return Containers.verticalFlow(horizontalSizing, verticalSizing)
}
override fun build() {
// like rootComponent, but better
root {
// components can be stored in variables...
val exampleLabel = label {
text("Example screen: 0".literal())
}
// or directly added to the root
button {
message = "Example button".literal()
// variables can be stored within components
var value = 0
onPress {
// components stored in variables can be modified
exampleLabel.text("Example screen: ${++value}".literal())
}
}
}
}
}
More examples on GitHub
90% of ad revenue goes to creators
Support creators and Modrinth ad-free with Modrinth+Compatibility
Minecraft: Java Edition
1.21
1.20.5–1.20.6
Platforms
Fabric