Skip to content

encodeToNbtTagRootless

fun <T> Nbt.encodeToNbtTagRootless(serializer: SerializationStrategy<T>, value: T): NbtTag

Like Nbt.encodeToNbtTag, but for class/polymorphic types unwraps the single top-level compound entry keyed by the serial name, returning its value directly instead of a one-entry NbtCompound wrapper.

inline fun <T> Nbt.encodeToNbtTagRootless(value: T): NbtTag

Reified variant of encodeToNbtTagRootless that resolves T's serializer automatically.