角膜

用于 polymer-virtual-entity 的 Kotlin DSL

基础库

cornea

一个为 polymer-virtual-entity 提供 Kotlin DSL 和扩展函数的库。它允许你以 DSL 风格编写元素和元素持有者,并使用实用的扩展函数。

注意:在 1.0.0 版本之前,API 可能会在没有事先通知的情况下发生变化。

Gradle 配置

Kotlin

repositories {
    mavenCentral()
}

dependencies {
    modImplementation("io.github.kouvali:cornea:YOUR_VERSION")
}

Groovy

repositories {
    mavenCentral()
}

dependencies {
    modImplementation "io.github.kouvali:cornea:YOUR_VERSION"
}

用法

这里有一个快速示例:

fun create() = elementHolder {
    blockDisplayElement {
        transformation {
            translateLocal(-0.5f, -0.5f, -0.5f)
            scaleLocal(0.75f)
        }

        onTick {
            transform {
                rotateLocalY(11.25f.toRadians())
            }

            startInterpolation(1)
        }

        blockState = Blocks.CAKE.defaultState
    }
}