Interface Codec.Encoder<T>

Type Parameters:
T - The target Java type.
Enclosing interface:
Codec<T>

public static interface Codec.Encoder<T>
Functional interface defining the encoding logic of a codec.
  • Method Summary

    Modifier and Type
    Method
    Description
    <D> DataResult<D>
    encode(DynamicOps<D> ops, T value)
    Encodes the Java object.
  • Method Details

    • encode

      <D> DataResult<D> encode(DynamicOps<D> ops, T value)
      Encodes the Java object.
      Type Parameters:
      D - The serialized data type.
      Parameters:
      ops - The dynamic operations instance.
      value - The value to encode.
      Returns:
      The encoded result.