Class CompoundListCodec<K,V>

java.lang.Object
com.mojang.serialization.codecs.CompoundListCodec<K,V>
All Implemented Interfaces:
Codec<List<Pair<K,V>>>, Decoder<List<Pair<K,V>>>, Encoder<List<Pair<K,V>>>

public final class CompoundListCodec<K,V> extends Object implements Codec<List<Pair<K,V>>>
  • Constructor Details

    • CompoundListCodec

      public CompoundListCodec(Codec<K> keyCodec, Codec<V> elementCodec)
  • Method Details

    • decode

      public <T> DataResult<Pair<List<Pair<K,V>>,T>> decode(DynamicOps<T> ops, T input)
      Description copied from interface: Decoder
      Decodes an object from a serialized form, returning any remaining serialized data.
      Specified by:
      decode in interface Decoder<K>
      Type Parameters:
      T - the type of the serialized form
      Parameters:
      ops - a DynamicOps for the serialized form
      input - the serialized form to decode
      Returns:
      a DataResult containing the decoded object and any remaining serialized data, or an error if the object could not be decoded
    • encode

      public <T> DataResult<T> encode(List<Pair<K,V>> input, DynamicOps<T> ops, T prefix)
      Description copied from interface: Encoder
      Encodes an object to a serialized form, adding to an existing prefix.
      Specified by:
      encode in interface Encoder<K>
      Type Parameters:
      T - the type to serialize to
      Parameters:
      input - the object to encode
      ops - a DynamicOps for the target serialized format
      prefix - existing data that the encoded object should be added to
      Returns:
      a DataResult containing the serialized form of the object, or an error if the object could not be serialized
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object