net.kernelpanicsoft.archie.serialization¶
Types¶
BlockHitResultSerializer¶
object BlockHitResultSerializer : KSerializer<BlockHitResult>
A KSerializer for BlockHitResult that encodes the hit location, face direction, block position, whether the hit is inside the block, and whether it was a miss.
BlockPosSerializer¶
object BlockPosSerializer : KSerializer<BlockPos>
A KSerializer for BlockPos that encodes/decodes the three integer components.
ChunkPosSerializer¶
object ChunkPosSerializer : KSerializer<ChunkPos>
A KSerializer for ChunkPos that encodes/decodes the value as a single packed Long.
CodecSerializer¶
open class CodecSerializer<T>(codec: Codec<T>) : KSerializer<T>
A KSerializer for Codec types using the active KOps implementations.
ColorSerializer¶
object ColorSerializer : KSerializer<Color>
FluidStackNBTHolderImpl¶
class FluidStackNBTHolderImpl(stack: FluidStack) : NBTHolder
FriendlyByteBufSerializer¶
object FriendlyByteBufSerializer : KSerializer<FriendlyByteBuf>
A KSerializer for FriendlyByteBuf that encodes/decodes the buffer contents as a raw byte array.
GlobalPosSerializer¶
object GlobalPosSerializer : KSerializer<GlobalPos>
A KSerializer for GlobalPos that encodes the dimension ResourceKey and BlockPos.
ItemStackNBTHolderImpl¶
class ItemStackNBTHolderImpl(stack: ItemStack) : NBTHolder
KOps¶
object KOps
ModifierKeyCodeSerializer¶
object ModifierKeyCodeSerializer : KSerializer<ModifierKeyCode>
NBTHolder¶
interface NBTHolder
An interface for managing NBT-backed fields on block entities, item stacks, or fluid stacks.
NBTHolderImpl¶
class NBTHolderImpl : NBTHolder
ResourceKeySerializer¶
class ResourceKeySerializer<T : Any>(val registry: ResourceKey<out Registry<T>>) : KSerializer<ResourceKey<*>>
A KSerializer for ResourceKey of a specific registry.
ResourceLocationSerializer¶
object ResourceLocationSerializer : KSerializer<ResourceLocation>
SBlockHitResult¶
typealias SBlockHitResult = BlockHitResult
Contextual type-alias for BlockHitResult that uses BlockHitResultSerializer when the field is annotated with @Contextual.
SBlockPos¶
typealias SBlockPos = BlockPos
Contextual type-alias for BlockPos that uses BlockPosSerializer when the field is annotated with @Contextual.
SChunkPos¶
typealias SChunkPos = ChunkPos
Contextual type-alias for ChunkPos that uses ChunkPosSerializer when the field is annotated with @Contextual.
SerializableResourceLocation¶
typealias SerializableResourceLocation = @Serializable
(with = ResourceLocationSerializer::class) ResourceLocation
SerializerCodec¶
class SerializerCodec<X>(serializer: KSerializer<X>) : Codec<X>
SFriendlyByteBuf¶
typealias SFriendlyByteBuf = FriendlyByteBuf
Contextual type-alias for FriendlyByteBuf that uses FriendlyByteBufSerializer when the field is annotated with @Contextual.
SGlobalPos¶
typealias SGlobalPos = GlobalPos
Contextual type-alias for GlobalPos that uses GlobalPosSerializer when the field is annotated with @Contextual.
SVec3¶
typealias SVec3 = Vec3
Contextual type-alias for Vec3 that uses Vec3Serializer when the field is annotated with @Contextual.
SVec3i¶
typealias SVec3i = Vec3i
Contextual type-alias for Vec3i that uses Vec3iSerializer when the field is annotated with @Contextual.
Sync¶
@Target
(allowedTargets = [AnnotationTarget.PROPERTY])annotation class Sync
Vec3iSerializer¶
object Vec3iSerializer : KSerializer<Vec3i>
A KSerializer for Vec3i (and its subclass BlockPos) that encodes/decodes the three integer components.
Vec3Serializer¶
object Vec3Serializer : KSerializer<Vec3>
A KSerializer for Vec3 that encodes/decodes the three double-precision components.
Properties¶
fromMinecraft¶
val CompoundTag.fromMinecraft: NbtCompound
val ListTag.fromMinecraft: NbtList<*>?
val Tag.fromMinecraft: NbtTag?
MinecraftSerializersModule¶
val MinecraftSerializersModule: SerializersModule
A SerializersModule that registers all built-in Minecraft type serializers as contextual serializers.
NBT¶
val NBT: Nbt
toMinecraft¶
val NbtCompound.toMinecraft: CompoundTag
val NbtList<*>.toMinecraft: ListTag
val NbtTag?.toMinecraft: Tag
Functions¶
buildComponentPatch¶
inline fun buildComponentPatch(builderAction: DataComponentPatch.Builder.() -> Unit): DataComponentPatch
buildCompoundTag¶
inline fun buildCompoundTag(builderAction: NbtCompoundBuilder.() -> Unit): CompoundTag
buildListTag¶
inline fun <T : NbtTag> buildListTag(builderAction: NbtListBuilder<T>.() -> Unit): ListTag
decodeFromNbtTagRootless¶
fun <T> Nbt.decodeFromNbtTagRootless(deserializer: DeserializationStrategy<T>, tag: NbtTag): T
defer¶
fun defer(deferred: () -> SerialDescriptor): SerialDescriptor
Returns serial descriptor that delegates all the calls to descriptor returned by deferred block. Used to resolve cyclic dependencies between recursive serializable structures.
DeferredArraySerializer¶
Returns serializer for reference Array of type E with descriptor of StructureKind.LIST kind. Each element of the array is serialized with the given elementSerializer.
Returns serializer for reference Array of type E with descriptor of StructureKind.LIST kind. Each element of the array is serialized with the given elementSerializer.
DeferredListSerializer¶
fun <T> DeferredListSerializer(elementSerializer: KSerializer<T>): KSerializer<List<T>>
DeferredMapSerializer¶
DeferredSetSerializer¶
fun <T> DeferredSetSerializer(elementSerializer: KSerializer<T>): KSerializer<Set<T>>
encodeToNbtTagRootless¶
fun <T> Nbt.encodeToNbtTagRootless(serializer: SerializationStrategy<T>, value: T): NbtTag
forEachTag¶
inline fun forEachTag(compoundTag: CompoundTag, action: (Map.Entry<String, NbtTag>) -> Unit)
inline fun forEachTag(listTag: ListTag, action: (NbtTag) -> Unit)
mergeToCompoundTag¶
inline fun mergeToCompoundTag(compoundTag: CompoundTag, builderAction: NbtCompoundBuilder.() -> Unit)
streamCodec¶
inline fun <T : Any> streamCodec(): StreamCodec<RegistryFriendlyByteBuf, T>