Class OptionalType<T>

java.lang.Object
com.viaversion.viaversion.api.type.Type<T>
com.viaversion.viaversion.api.type.OptionalType<T>
All Implemented Interfaces:
ByteBufReader<T>, ByteBufWriter<T>
Direct Known Subclasses:
BlockPositionType1_14.OptionalBlockPositionType, BlockPositionType1_8.OptionalBlockPositionType, BooleanType.OptionalBooleanType, ByteArrayType.OptionalByteArrayType, ComponentType.OptionalComponentType, CompoundTagType.OptionalCompoundTagType, FloatType.OptionalFloatType, GlobalBlockPositionType.OptionalGlobalPositionType, HolderSetType.OptionalHolderSetType, ItemCostType1_20_5.OptionalItemCostType, ItemType1_20_5.OptionalItemType, NamedCompoundTagType.OptionalNamedCompoundTagType, PlayerMessageSignatureType.OptionalPlayerMessageSignatureType, ProfileKeyType.OptionalProfileKeyType, StringType.OptionalStringType, TagType.OptionalTagType, UUIDType.OptionalUUIDType

public abstract class OptionalType<T> extends Type<T>
  • Constructor Details

    • OptionalType

      protected OptionalType(Type<T> type)
  • Method Details

    • read

      public @Nullable T read(io.netty.buffer.ByteBuf buffer)
      Description copied from interface: ByteBufReader
      Reads a value from a ByteBuf.
      Parameters:
      buffer - buffer to read from
      Returns:
      type based on the class type
    • write

      public void write(io.netty.buffer.ByteBuf buffer, @Nullable T value)
      Description copied from interface: ByteBufWriter
      Writes an object to a type to a ByteBuf.
      Parameters:
      buffer - buffer to write to
      value - value to write