Package-level declarations

Types

Link copied to clipboard
sealed interface CompositeNbtDecoder : CompositeDecoder
Link copied to clipboard
sealed interface CompositeNbtEncoder : CompositeEncoder
Link copied to clipboard
sealed class Nbt : NbtFormat, BinaryFormat
Link copied to clipboard

Builder of the Nbt instance provided by Nbt { ... } factory function.

Link copied to clipboard
@Serializable(with = NbtByteSerializer::class)
value class NbtByte(val value: Byte) : NbtTag
Link copied to clipboard
@Serializable(with = NbtByteArraySerializer::class)
class NbtByteArray : NbtTag, List<Byte>
Link copied to clipboard
@Serializable(with = NbtCompoundSerializer::class)
class NbtCompound(content: Map<String, NbtTag>) : NbtTag, Map<String, NbtTag>
Link copied to clipboard
Link copied to clipboard
abstract class NbtCompression
Link copied to clipboard
Link copied to clipboard
abstract class NbtContentPolymorphicSerializer<T : Any>(baseClass: KClass<T>) : KSerializer<T>

Base class for custom serializers that allows selecting polymorphic serializer without a dedicated class discriminator, on a content basis.

Link copied to clipboard
sealed interface NbtDecoder : Decoder
Link copied to clipboard
@Serializable(with = NbtDoubleSerializer::class)
value class NbtDouble(val value: Double) : NbtTag
Link copied to clipboard
sealed interface NbtEncoder : Encoder
Link copied to clipboard
@Serializable(with = NbtFloatSerializer::class)
value class NbtFloat(val value: Float) : NbtTag
Link copied to clipboard
sealed interface NbtFormat : SerialFormat
Link copied to clipboard
sealed interface NbtFormatBuilder
Link copied to clipboard
sealed interface NbtFormatConfiguration
Link copied to clipboard
@Serializable(with = NbtIntSerializer::class)
value class NbtInt(val value: Int) : NbtTag
Link copied to clipboard
@Serializable(with = NbtIntArraySerializer::class)
class NbtIntArray : NbtTag, List<Int>
Link copied to clipboard
@Serializable(with = NbtListSerializer::class)
class NbtList<out T : NbtTag> : NbtTag, List<T>
Link copied to clipboard
Link copied to clipboard
@Serializable(with = NbtLongSerializer::class)
value class NbtLong(val value: Long) : NbtTag
Link copied to clipboard
@Serializable(with = NbtLongArraySerializer::class)
class NbtLongArray : NbtTag, List<Long>
Link copied to clipboard
@Serializable(with = NbtShortSerializer::class)
value class NbtShort(val value: Short) : NbtTag
Link copied to clipboard
@Serializable(with = NbtStringSerializer::class)
value class NbtString(val value: String) : NbtTag
Link copied to clipboard
@Serializable(with = NbtTagSerializer::class)
sealed interface NbtTag
Link copied to clipboard
abstract class NbtTransformingSerializer<T : Any>(tSerializer: KSerializer<T>) : KSerializer<T>

Base class for custom serializers that allows manipulating an abstract NBT representation of the class before serialization or deserialization.

Link copied to clipboard
abstract class NbtVariant
Link copied to clipboard
sealed class StringifiedNbt : NbtFormat, StringFormat
Link copied to clipboard

Builder of the StringifiedNbt instance provided by StringifiedNbt { ... } factory function.

Properties

Link copied to clipboard

Convenience method to get this element as an NbtByte

Link copied to clipboard

Convenience method to get this element as an NbtByteArray

Link copied to clipboard

Convenience method to get this element as an NbtCompound

Link copied to clipboard

Convenience method to get this element as an NbtDouble

Link copied to clipboard

Convenience method to get this element as an NbtFloat

Link copied to clipboard

Convenience method to get this element as an NbtInt

Link copied to clipboard

Convenience method to get this element as an NbtIntArray

Link copied to clipboard

Convenience method to get this element as an NbtList

Link copied to clipboard

Convenience method to get this element as an NbtLong

Link copied to clipboard

Convenience method to get this element as an NbtLongArray

Link copied to clipboard

Convenience method to get this element as an NbtShort

Link copied to clipboard

Convenience method to get this element as an NbtString

Functions

Link copied to clipboard
Link copied to clipboard
@JvmName(name = "addNbtList$T")
inline fun <T : NbtTag> NbtListBuilder<NbtList<T>>.addNbtList(builderAction: NbtListBuilder<T>.() -> Unit): Boolean
inline fun <T : NbtTag> NbtListBuilder<NbtList<NbtTag>>.addNbtList(builderAction: NbtListBuilder<T>.() -> Unit): Boolean
Link copied to clipboard
fun Decoder.asNbtDecoder(): NbtDecoder
Link copied to clipboard
fun Encoder.asNbtEncoder(): NbtEncoder
Link copied to clipboard
inline fun buildNbtCompound(builderAction: NbtCompoundBuilder.() -> Unit): NbtCompound

inline fun buildNbtCompound(name: String, builderAction: NbtCompoundBuilder.() -> Unit): NbtCompound

Build an NbtCompound suitable for being written to an NBT file.

Link copied to clipboard
inline fun <T : NbtTag> buildNbtList(builderAction: NbtListBuilder<T>.() -> Unit): NbtList<T>

inline fun <T : NbtTag> buildNbtList(name: String, builderAction: NbtListBuilder<T>.() -> Unit): NbtCompound

Build an NbtList suitable for being written to an NBT file.

Link copied to clipboard
inline fun <T> NbtFormat.decodeFromNbtTag(tag: NbtTag): T

Decodes and deserializes the given tag to a value of type T using serializer retrieved from the reified type parameter.

Link copied to clipboard
inline fun <T> Nbt.decodeFromSource(source: Source): T

Decode NBT from a Source.

Link copied to clipboard
inline fun <T> Nbt.decodeFromStream(input: InputStream): T
fun <T> Nbt.decodeFromStream(deserializer: DeserializationStrategy<T>, input: InputStream): T

Decode NBT from an InputStream.

Link copied to clipboard

Peek in the byteArray and detect what NbtCompression is used.

fun NbtCompression.Companion.detect(source: BufferedSource): NbtCompression

Peek in the source and detect what NbtCompression is used.

Peek in the stream and detect what NbtCompression is used.

Link copied to clipboard
inline fun <T> NbtFormat.encodeToNbtTag(value: T): NbtTag

Serializes and encodes the given value to an NbtTag using serializer retrieved from the reified type parameter.

Link copied to clipboard
inline fun <T> Nbt.encodeToSink(value: T, sink: Sink)

Encode NBT to a Sink.

Link copied to clipboard
inline fun <T> Nbt.encodeToStream(value: T, output: OutputStream)
fun <T> Nbt.encodeToStream(serializer: SerializationStrategy<T>, value: T, output: OutputStream)

Encode NBT to an OutputStream.

Link copied to clipboard
fun Nbt(from: Nbt = DefaultNbt, builderAction: NbtBuilder.() -> Unit): Nbt

Creates an instance of Nbt configured from the optionally given Nbt instance and adjusted with builderAction.

Link copied to clipboard
inline fun <T : NbtTag> NbtTag.nbtList(): NbtList<T>

Convenience method to get this element as an NbtList<T>

Link copied to clipboard
Link copied to clipboard
inline fun NbtCompoundBuilder.putNbtCompound(key: String, builderAction: NbtCompoundBuilder.() -> Unit): NbtTag?
Link copied to clipboard
@JvmName(name = "putNbtList$T")
inline fun <T : NbtTag> NbtCompoundBuilder.putNbtList(key: String, builderAction: NbtListBuilder<T>.() -> Unit): NbtTag?
Link copied to clipboard
fun StringifiedNbt(from: StringifiedNbt = StringifiedNbt.Default, builderAction: StringifiedNbtBuilder.() -> Unit): StringifiedNbt

Creates an instance of StringifiedNbt configured from the optionally given StringifiedNbt instance and adjusted with builderAction.