BenWoodworth / knbt

Kotlin NBT library for kotlinx.serialization
GNU Lesser General Public License v3.0
79 stars 3 forks source link

Add a way to tell for encoder what kind of NBT tag to encode collections as #16

Closed BenWoodworth closed 1 year ago

BenWoodworth commented 2 years ago

E.g.

@Serializable
data class NbtMyIntArray(
    @NbtType(NbtIntArray::class)
    val intArray: List<Int> // Encode as `NbtIntArray` instead of `NbtList<NbtInt>`
)
BenWoodworth commented 1 year ago

Resolved by adding a @NbtArray annotation. See here