云纹

用于polymer-virtual-entity的Kotlin DSL

基础库

moire

moire 是一个 Kotlin 库,为 polymer-virtual-entity 提供扩展函数和 DSL。使用 moire,你可以轻松创建和管理 ElementHolder 实例。

注意: 在 1.0.0 版本之前,API 可能会在不向后兼容的情况下发生变更。请注意潜在的变化。

Gradle 配置

Groovy

repositories {
    maven { url 'https://maven.nucleoid.xyz/' }
    maven { url 'https://api.modrinth.com/maven' }
}

dependencies {
    modImplementation 'eu.pb4:polymer-virtual-entity:POLYMER_VERSION'
    modImplementation 'maven.modrinth:moire:MOIRE_VERSION'
}

Kotlin DSL

repositories {
    maven("https://maven.nucleoid.xyz/")
    maven("https://api.modrinth.com/maven")
}

dependencies {
    modImplementation("eu.pb4:polymer-virtual-entity:POLYMER_VERSION")
    modImplementation("maven.modrinth:moire:MOIRE_VERSION")
}

用法

以下是一个简单的示例。

import jp.fishmans.moire.elements.*
import jp.fishmans.moire.matrices.rotateLocalYDegrees
import net.minecraft.item.Items

fun create() = elementHolder {
    itemDisplayElement {
        transformation {
            scaleLocal(0.5f)
        }

        onTick {
            transform {
                rotateLocalYDegrees(11.25f)
            }

            startInterpolationIfDirty(1)
        }

        item = Items.TNT.defaultStack
        teleportDuration = 1
    }
}