Record Class UnboundMapStreamCodec<B extends io.netty.buffer.ByteBuf, K, V>

java.lang.Object
java.lang.Record
dev.latvian.mods.klib.codec.UnboundMapStreamCodec<B,K,V>
All Implemented Interfaces:
KLibStreamCodec<B,Map<K,V>>, net.minecraft.network.codec.StreamCodec<B,Map<K,V>>, net.minecraft.network.codec.StreamDecoder<B,Map<K,V>>, net.minecraft.network.codec.StreamEncoder<B,Map<K,V>>

public record UnboundMapStreamCodec<B extends io.netty.buffer.ByteBuf, K, V>(net.minecraft.network.codec.StreamCodec<? super B extends io.netty.buffer.ByteBuf, K> keyCodec, net.minecraft.network.codec.StreamCodec<? super B extends io.netty.buffer.ByteBuf, V> valueCodec, boolean ordered, boolean identity) extends Record implements net.minecraft.network.codec.StreamCodec<B,Map<K,V>>
  • Nested Class Summary

    Nested classes/interfaces inherited from interface net.minecraft.network.codec.StreamCodec

    net.minecraft.network.codec.StreamCodec.CodecOperation<B,S,T>
  • Constructor Summary

    Constructors
    Constructor
    Description
    UnboundMapStreamCodec(net.minecraft.network.codec.StreamCodec<? super B, K> keyCodec, net.minecraft.network.codec.StreamCodec<? super B, V> valueCodec, boolean ordered, boolean identity)
    Creates an instance of a UnboundMapStreamCodec record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    decode(B buf)
     
    void
    encode(B buf, Map<K,V> value)
     
    final boolean
    Indicates whether some other object is "equal to" this one.
    final int
    Returns a hash code value for this object.
    boolean
    Returns the value of the identity record component.
    net.minecraft.network.codec.StreamCodec<? super B, K>
    Returns the value of the keyCodec record component.
    boolean
    Returns the value of the ordered record component.
    final String
    Returns a string representation of this record class.
    net.minecraft.network.codec.StreamCodec<? super B, V>
    Returns the value of the valueCodec record component.

    Methods inherited from class Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait

    Methods inherited from interface net.minecraft.network.codec.StreamCodec

    apply, cast, dispatch, map, mapStream
  • Constructor Details

    • UnboundMapStreamCodec

      public UnboundMapStreamCodec(net.minecraft.network.codec.StreamCodec<? super B, K> keyCodec, net.minecraft.network.codec.StreamCodec<? super B, V> valueCodec, boolean ordered, boolean identity)
      Creates an instance of a UnboundMapStreamCodec record class.
      Parameters:
      keyCodec - the value for the keyCodec record component
      valueCodec - the value for the valueCodec record component
      ordered - the value for the ordered record component
      identity - the value for the identity record component
  • Method Details

    • decode

      public Map<K,V> decode(B buf)
      Specified by:
      decode in interface net.minecraft.network.codec.StreamDecoder<B extends io.netty.buffer.ByteBuf, K>
    • encode

      public void encode(B buf, Map<K,V> value)
      Specified by:
      encode in interface net.minecraft.network.codec.StreamEncoder<B extends io.netty.buffer.ByteBuf, K>
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with the compare method from their corresponding wrapper classes.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • keyCodec

      public net.minecraft.network.codec.StreamCodec<? super B, K> keyCodec()
      Returns the value of the keyCodec record component.
      Returns:
      the value of the keyCodec record component
    • valueCodec

      public net.minecraft.network.codec.StreamCodec<? super B, V> valueCodec()
      Returns the value of the valueCodec record component.
      Returns:
      the value of the valueCodec record component
    • ordered

      public boolean ordered()
      Returns the value of the ordered record component.
      Returns:
      the value of the ordered record component
    • identity

      public boolean identity()
      Returns the value of the identity record component.
      Returns:
      the value of the identity record component