Record Class NeoForgeExtraCodecs.AlternativeCodec<T>

java.lang.Object
java.lang.Record
net.neoforged.neoforge.common.util.NeoForgeExtraCodecs.AlternativeCodec<T>
All Implemented Interfaces:
com.mojang.serialization.Codec<T>, com.mojang.serialization.Decoder<T>, com.mojang.serialization.Encoder<T>
Enclosing class:
NeoForgeExtraCodecs

private static record NeoForgeExtraCodecs.AlternativeCodec<T>(com.mojang.serialization.Codec<T> codec, com.mojang.serialization.Codec<T> alternative) extends Record implements com.mojang.serialization.Codec<T>
  • Nested Class Summary Link icon

    Nested classes/interfaces inherited from interface com.mojang.serialization.Codec Link icon

    com.mojang.serialization.Codec.RecursiveCodec<T>, com.mojang.serialization.Codec.ResultFunction<A>

    Nested classes/interfaces inherited from interface com.mojang.serialization.Decoder Link icon

    com.mojang.serialization.Decoder.Boxed<A>, com.mojang.serialization.Decoder.Simple<A>, com.mojang.serialization.Decoder.Terminal<A>
  • Field Summary Link icon

    Fields
    Modifier and Type
    Field
    Description
    private final com.mojang.serialization.Codec<T>
    The field for the alternative record component.
    private final com.mojang.serialization.Codec<T>
    The field for the codec record component.

    Fields inherited from interface com.mojang.serialization.Codec Link icon

    BOOL, BYTE, BYTE_BUFFER, DOUBLE, EMPTY, FLOAT, INT, INT_STREAM, LONG, LONG_STREAM, PASSTHROUGH, SHORT, STRING
  • Constructor Summary Link icon

    Constructors
    Modifier
    Constructor
    Description
    private
    AlternativeCodec(com.mojang.serialization.Codec<T> codec, com.mojang.serialization.Codec<T> alternative)
    Creates an instance of a AlternativeCodec record class.
  • Method Summary Link icon

    Modifier and Type
    Method
    Description
    com.mojang.serialization.Codec<T>
    Returns the value of the alternative record component.
    com.mojang.serialization.Codec<T>
    Returns the value of the codec record component.
    <T1> com.mojang.serialization.DataResult<com.mojang.datafixers.util.Pair<T,T1>>
    decode(com.mojang.serialization.DynamicOps<T1> ops, T1 input)
     
    <T1> com.mojang.serialization.DataResult<T1>
    encode(T input, com.mojang.serialization.DynamicOps<T1> ops, T1 prefix)
     
    final boolean
    Indicates whether some other object is "equal to" this one.
    final int
    Returns a hash code value for this object.
    Returns a string representation of this record class.

    Methods inherited from class java.lang.Object Link icon

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

    Methods inherited from interface com.mojang.serialization.Codec Link icon

    comapFlatMap, deprecated, dispatch, dispatch, dispatchMap, dispatchMap, dispatchStable, fieldOf, flatComapMap, flatXmap, lenientOptionalFieldOf, lenientOptionalFieldOf, lenientOptionalFieldOf, lenientOptionalFieldOf, listOf, listOf, mapResult, optionalFieldOf, optionalFieldOf, optionalFieldOf, optionalFieldOf, orElse, orElse, orElse, orElseGet, orElseGet, orElseGet, partialDispatch, promotePartial, sizeLimitedListOf, stable, validate, withLifecycle, xmap

    Methods inherited from interface com.mojang.serialization.Decoder Link icon

    boxed, decode, flatMap, map, parse, parse, simple, terminal

    Methods inherited from interface com.mojang.serialization.Encoder Link icon

    comap, encodeStart, flatComap
  • Field Details Link icon

    • codec Link icon

      private final com.mojang.serialization.Codec<T> codec
      The field for the codec record component.
    • alternative Link icon

      private final com.mojang.serialization.Codec<T> alternative
      The field for the alternative record component.
  • Constructor Details Link icon

    • AlternativeCodec Link icon

      private AlternativeCodec(com.mojang.serialization.Codec<T> codec, com.mojang.serialization.Codec<T> alternative)
      Creates an instance of a AlternativeCodec record class.
      Parameters:
      codec - the value for the codec record component
      alternative - the value for the alternative record component
  • Method Details Link icon

    • decode Link icon

      public <T1> com.mojang.serialization.DataResult<com.mojang.datafixers.util.Pair<T,T1>> decode(com.mojang.serialization.DynamicOps<T1> ops, T1 input)
      Specified by:
      decode in interface com.mojang.serialization.Decoder<T>
    • encode Link icon

      public <T1> com.mojang.serialization.DataResult<T1> encode(T input, com.mojang.serialization.DynamicOps<T1> ops, T1 prefix)
      Specified by:
      encode in interface com.mojang.serialization.Encoder<T>
    • toString Link icon

      public 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 Link icon

      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 Link icon

      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. All components in this record class are compared with Objects::equals(Object,Object).
      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.
    • codec Link icon

      public com.mojang.serialization.Codec<T> codec()
      Returns the value of the codec record component.
      Returns:
      the value of the codec record component
    • alternative Link icon

      public com.mojang.serialization.Codec<T> alternative()
      Returns the value of the alternative record component.
      Returns:
      the value of the alternative record component