Interface NbtComponentSerializer

All Superinterfaces:
net.kyori.adventure.text.serializer.ComponentDecoder<Object,net.kyori.adventure.text.Component>, net.kyori.adventure.text.serializer.ComponentEncoder<net.kyori.adventure.text.Component,Object>, net.kyori.adventure.text.serializer.ComponentSerializer<net.kyori.adventure.text.Component,net.kyori.adventure.text.Component,Object>

public interface NbtComponentSerializer extends net.kyori.adventure.text.serializer.ComponentSerializer<net.kyori.adventure.text.Component,net.kyori.adventure.text.Component,Object>
This serializer serializes and deserializes Components to and from NBT tags represented using Cloudburst's NBT library.

The serializer supports all modern component, click, and hover event types. It does not support serializing and deserializing older component formats - only the latest Minecraft version is supported. Implementation notes are as follows:

  • The serializer implements DialogLike to deserialize "show_dialog" click events. The implementation can be found at NbtDialog. It is a simple implementation, only holding the Key reference to a dialog, or the inline-defined the dialog, serialized as NbtMap. The serializer can only ever serialize "show_dialog" click events with a NbtDialog DialogLike implementation, it will throw IllegalArgumentException for other implementations.
  • The serializer implements DataComponentValue to deserialize "show_item" hover events. The implementation can be found at NbtDataComponentValue. It is a simple implementation, only holding the raw value of the data component, serialized to NBT, represented as an Object. Note that the serializer uses DataComponentValue.removed() to represent removed data components. The serializer can only ever serialize "show_item" hover events with NbtDataComponentValue DataComponentValues, it will throw IllegalArgumentException for other implementations.
  • The serializer does not implement the deserializing and serializing of payloads of "custom" click events. It will silently drop any that are found.
See Also:
  • Method Summary

    Static Methods
    Modifier and Type
    Method
    Description
    nbt()
     

    Methods inherited from interface net.kyori.adventure.text.serializer.ComponentSerializer

    deserialize, deserializeOr, deserializeOrNull, serialize, serializeOr, serializeOrNull