Interface StructuredData<T>

All Superinterfaces:
IdHolder

public interface StructuredData<T> extends IdHolder
  • Method Summary

    Modifier and Type
    Method
    Description
    static <T> StructuredData<T>
    empty(StructuredDataKey<T> key, int id)
    Returns empty structured data, equivalent to an empty Optional in vanilla.
    boolean
    Returns whether the structured data is empty.
    default boolean
    Returns whether the structured data is present.
    key()
     
    static <T> StructuredData<T>
    of(StructuredDataKey<T> key, T value, int id)
    Returns filled structured data, equivalent to an Optional with a value in vanilla.
    void
    setId(int id)
     
    void
    setValue(T value)
     
    @Nullable T
     
    void
    write(io.netty.buffer.ByteBuf buffer)
     

    Methods inherited from interface com.viaversion.viaversion.util.IdHolder

    id
  • Method Details

    • of

      static <T> StructuredData<T> of(StructuredDataKey<T> key, T value, int id)
      Returns filled structured data, equivalent to an Optional with a value in vanilla.
      Type Parameters:
      T - serializer type
      Parameters:
      key - serializer key
      value - value
      id - serializer id
      Returns:
      filled structured data
    • empty

      static <T> StructuredData<T> empty(StructuredDataKey<T> key, int id)
      Returns empty structured data, equivalent to an empty Optional in vanilla.
      Parameters:
      key - serializer key
      id - serializer id
      Returns:
      empty structured data
    • setValue

      void setValue(T value)
    • write

      void write(io.netty.buffer.ByteBuf buffer)
    • setId

      void setId(int id)
    • key

    • value

      @Nullable T value()
    • isPresent

      default boolean isPresent()
      Returns whether the structured data is present. Even if true, the value may be null.
      Returns:
      true if the structured data is present
    • isEmpty

      boolean isEmpty()
      Returns whether the structured data is empty. Not to be confused with a null value.
      Returns:
      true if the structured data is empty