Interface TagSerializer<T>

Type Parameters:
T - the type to serialize

public interface TagSerializer<T>
Interface used to create custom tags.
  • Field Details

    • COMPOUND

      @Experimental static final TagSerializer<net.kyori.adventure.nbt.CompoundBinaryTag> COMPOUND
  • Method Details

    • read

      @Nullable T read(TagReadable reader)
      Reads the custom tag from a TagReadable.
      Parameters:
      reader - the reader
      Returns:
      the deserialized value, null if invalid
    • write

      void write(TagWritable writer, T value)
      Writes the custom tag to a TagWritable.
      Parameters:
      writer - the writer
      value - the value to serialize
    • fromCompound

      @Experimental static <T> TagSerializer<T> fromCompound(Function<net.kyori.adventure.nbt.CompoundBinaryTag,T> reader, Function<T,net.kyori.adventure.nbt.CompoundBinaryTag> writer)