Record Class SetCodec<E>
java.lang.Object
java.lang.Record
com.portingdeadmods.portingdeadlibs.utils.codec.SetCodec<E>
- All Implemented Interfaces:
com.mojang.serialization.Codec<Set<E>>,com.mojang.serialization.Decoder<Set<E>>,com.mojang.serialization.Encoder<Set<E>>
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.mojang.serialization.Codec
com.mojang.serialization.Codec.RecursiveCodec<T>, com.mojang.serialization.Codec.ResultFunction<A>Nested classes/interfaces inherited from interface com.mojang.serialization.Decoder
com.mojang.serialization.Decoder.Boxed<A>, com.mojang.serialization.Decoder.Simple<A>, com.mojang.serialization.Decoder.Terminal<A> -
Field Summary
Fields inherited from interface com.mojang.serialization.Codec
BOOL, BYTE, BYTE_BUFFER, DOUBLE, EMPTY, FLOAT, INT, INT_STREAM, LONG, LONG_STREAM, PASSTHROUGH, SHORT, STRING -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondecode(com.mojang.serialization.DynamicOps<T> ops, T input) com.mojang.serialization.Codec<E> Returns the value of theelementCodecrecord component.<T> com.mojang.serialization.DataResult<T> final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.intmaxSize()Returns the value of themaxSizerecord component.intminSize()Returns the value of theminSizerecord component.Returns the value of thesetSupplierrecord component.toString()Returns a string representation of this record class.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface com.mojang.serialization.Codec
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, xmapMethods inherited from interface com.mojang.serialization.Decoder
boxed, decode, flatMap, map, parse, parse, simple, terminalMethods inherited from interface com.mojang.serialization.Encoder
comap, encodeStart, flatComap
-
Constructor Details
-
SetCodec
public SetCodec(com.mojang.serialization.Codec<E> elementCodec, int minSize, int maxSize, Supplier<? extends Set<E>> setSupplier) Creates an instance of aSetCodecrecord class.- Parameters:
elementCodec- the value for theelementCodecrecord componentminSize- the value for theminSizerecord componentmaxSize- the value for themaxSizerecord componentsetSupplier- the value for thesetSupplierrecord component
-
-
Method Details
-
encode
public <T> com.mojang.serialization.DataResult<T> encode(Set<E> input, com.mojang.serialization.DynamicOps<T> ops, T prefix) - Specified by:
encodein interfacecom.mojang.serialization.Encoder<E>
-
decode
public <T> com.mojang.serialization.DataResult<com.mojang.datafixers.util.Pair<Set<E>,T>> decode(com.mojang.serialization.DynamicOps<T> ops, T input) - Specified by:
decodein interfacecom.mojang.serialization.Decoder<E>
-
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. -
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. -
equals
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 withObjects::equals(Object,Object); primitive components are compared with '=='. -
elementCodec
Returns the value of theelementCodecrecord component.- Returns:
- the value of the
elementCodecrecord component
-
minSize
public int minSize()Returns the value of theminSizerecord component.- Returns:
- the value of the
minSizerecord component
-
maxSize
public int maxSize()Returns the value of themaxSizerecord component.- Returns:
- the value of the
maxSizerecord component
-
setSupplier
Returns the value of thesetSupplierrecord component.- Returns:
- the value of the
setSupplierrecord component
-