通用
KattonNbtApi
根据 Number 值创建数值类型的 Tag。
numericTagOf
getValue
invoke
getOrValue
invoke
toBoolean
kotlin
fun ByteTag?.toBoolean(): Boolean将 ByteTag 转换为布尔值。
parseNbt
getEntityNbt
setEntityNbt
kotlin
fun setEntityNbt(entity: Entity, tag: CompoundTag)替换实体的 NBT 数据。
参数
| 参数 | 说明 |
|---|---|
entity | 目标实体。 |
tag | 要设置到实体上的 CompoundTag。 |
getBlockNbt
setBlockNbt
kotlin
fun setBlockNbt(block: BlockEntity, tag: CompoundTag)替换方块实体的 NBT 数据。
参数
| 参数 | 说明 |
|---|---|
block | 目标方块实体。 |
tag | 要设置到方块实体上的 CompoundTag。 |
getBlockNbt
setBlockNbt
getStorageNbt
setStorageNbt
kotlin
fun setStorageNbt(id: Identifier, tag: CompoundTag)通过标识符设置命令存储中的 NBT。
参数
| 参数 | 说明 |
|---|---|
id | 存储标识符。 |
tag | 要存储的 CompoundTag。 |
