kotlin
fun <T : Any> registerNativePersistentDataComponentType(id: String, registerMode: RegisterMode = RegisterMode.WORLD, codec: Codec<T>): KattonRegistry.KattonDataComponentTypeEntry注册持久化(保存到磁盘)的 DataComponentType,并支持热重载。 持久化组件会使用其 codec 进行序列化,并随物品一并保存。 适用于必须跨存档读写周期保留的数据。
参数
| 参数 | 说明 |
|---|---|
id | 组件标识符,例如 "mymod:custom_data"。 |
registerMode | 注册模式(GLOBAL、WORLD 或 RELOADABLE)。 |
codec | 用于序列化和反序列化组件值的 codec。 |
返回值
已注册的 KattonDataComponentTypeEntry。
