Перейти к содержимому
Mineforgian

κoωo (kowo-lib)

Fancy™ kotlin syntax for oωo-lib

Загрузки
1K
Подписчики
3
Обновлён
10 мая 2025 г.
Лицензия
MIT

Опубликован 23 мая 2024 г.

Icon

Fancy™ kotlin syntax for oωo-lib

Setup

In your build.gradle file, add these lines:

repositories {
    maven { url "https://api.modrinth.com/maven" }
    maven { url "https://maven.wispforest.io/releases" }
}

dependencies {
    modImplementation include("maven.modrinth:kowo-lib:0.12.20b+1.21.5")

    modImplementation "io.wispforest:owo-lib:0.12.20+1.21.5"
    // only if you plan to use owo-config
    // annotationProcessor "io.wispforest:owo-lib:0.12.20+1.21.5"
}

kotlin {
    compilerOptions {
        freeCompilerArgs.add("-Xcontext-parameters")
    }
}

Example usage

import xyz.bonfiremc.kowo.dsl.*

class SizingTestKuwuScreen : BaseOwoScreen<FlowLayout>() {
    override fun createAdapter(): OwoUIAdapter<FlowLayout> {
        return OwoUIAdapter.create(this, ::verticalFlow)
    }

    override fun build(rootComponent: FlowLayout) {
        root {
            verticalAlignment = VerticalAlignment.CENTER
            horizontalAlignment = HorizontalAlignment.CENTER

            +stack(Sizing.content(), Sizing.content()).apply {
                padding {
                    all(15)
                }
                horizontalAlignment = HorizontalAlignment.CENTER
                surface = Surface.panelWithInset(6)

                val animation: Animation<Sizing> = horizontalSizing().animate(500, Easing.CUBIC, 75.fill)

                +button("initialize sizenite".literal).apply {
                    horizontalSizing = 50.fill

                    onPress {
                        animation.reverse()
                    }
                }
            }

            +label("bruh".literal.styled { it.withClickEvent(ClickEvent.OpenUrl(URI.create("https://wispforest.io"))) })
        }
    }
}

More examples on GitHub

TODO

  • Simplified way to add child to parent component
  • More examples
  • Styling with MSS (Minecraft Style Sheets)

Ченджлог

0.12.20b+1.21.5Бета1.21.6, 1.21.7, 1.21.8 · 10 мая 2025 г.

Changes

  • Added simplified way to add child
  • positioning now available for Component
0.12.20+1.21.5Бета1.21.5 · 24 апреля 2025 г.

Changes

  • Updated to 1.21.5
  • Updated oωo to 0.12.20+1.21.5
  • Now oωo is not included in .jar
  • Fully rewrited, see examples, don't forget to write import ua.mei.kowo.dsl.*
0.12.10+1.21Альфа1.21 · 29 июня 2024 г.
  • Ported to Minecraft 1.21
  • Updated to oωo 0.12.10
  • Now uses Kotlin 2.0.0
  • Added custom components support
0.12.8+1.20.5Альфа1.20.5, 1.20.6 · 23 мая 2024 г.

Maybe first working version

Комментарии

Загружаем…