Interface BinaryTagHolder

All Superinterfaces:
DataComponentValue, DataComponentValue.TagSerializable

public interface BinaryTagHolder extends DataComponentValue.TagSerializable
Holds a compound binary tag.

Instead of including an entire NBT implementation in Adventure, it was decided to use this "holder" interface instead. This opens the door for platform specific implementations.

See net.kyori.adventure.nbt.impl for a platform agnostic implementation.

Since:
4.0.0
  • Method Details

    • encode

      static <T, EX extends Exception> BinaryTagHolder encode(T nbt, Codec<? super T,String,?,EX> codec) throws EX
      Encodes nbt using codec.
      Type Parameters:
      T - the binary tag type
      EX - encode exception type
      Parameters:
      nbt - the binary tag
      codec - the codec
      Returns:
      the encoded binary tag holder
      Throws:
      EX - if an error occurred while encoding the binary tag
      Since:
      4.0.0
    • binaryTagHolder

      static BinaryTagHolder binaryTagHolder(String string)
      Creates an encoded binary tag holder.
      Parameters:
      string - the encoded binary tag value
      Returns:
      the encoded binary tag
      Since:
      4.10.0
    • string

      String string()
      Gets the raw string value.
      Returns:
      the raw string value
      Since:
      4.0.0
    • asBinaryTag

      default BinaryTagHolder asBinaryTag()
      Description copied from interface: DataComponentValue.TagSerializable
      Convert this value into a binary tag value.
      Specified by:
      asBinaryTag in interface DataComponentValue.TagSerializable
      Returns:
      the binary tag value
    • get

      <T, DX extends Exception> T get(Codec<T,String,DX,?> codec) throws DX
      Gets the held value as a binary tag.
      Type Parameters:
      T - the binary tag type
      DX - decode thrown exception type
      Parameters:
      codec - the codec
      Returns:
      the binary tag
      Throws:
      DX - if an error occurred while retrieving the binary tag
      Since:
      4.0.0