package com.dulkirfabric.config.serializations import kotlinx.serialization.KSerializer import kotlinx.serialization.descriptors.PrimitiveKind import kotlinx.serialization.descriptors.PrimitiveSerialDescriptor import kotlinx.serialization.descriptors.SerialDescriptor import kotlinx.serialization.encoding.Decoder import kotlinx.serialization.encoding.Encoder import net.minecraft.client.util.InputUtil object KeySerializer: KSerializer { override val descriptor: SerialDescriptor = PrimitiveSerialDescriptor("InputUtil.Key", PrimitiveKind.INT) override fun deserialize(decoder: Decoder): InputUtil.Key { return InputUtil.fromKeyCode(decoder.decodeInt(), 0) } override fun serialize(encoder: Encoder, value: InputUtil.Key) { encoder.encodeInt(value.code) } }