Class FingerprintCodec<T>
java.lang.Object
net.darkhax.bookshelf.common.impl.data.loot.modifiers.FingerprintCodec<T>
- Type Parameters:
T- The type for the codec to serialize.
- All Implemented Interfaces:
com.mojang.serialization.Codec<T>,com.mojang.serialization.Decoder<T>,com.mojang.serialization.Encoder<T>
A codec wrapper that adds functionality to compute and set a fingerprint hash for certain objects during decoding.
This is achieved by hashing the JSON representation of the input.
This implementation is only intended for the LootPool codec. Loot pools do not have their own identity, so we use this hash to keep track of their position within a LootTable and to detect if a user has overwritten the input.
-
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
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, 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
-
FingerprintCodec
-
-
Method Details
-
decode
public <T1> com.mojang.serialization.DataResult<com.mojang.datafixers.util.Pair<T,T1>> decode(com.mojang.serialization.DynamicOps<T1> ops, T1 input) - Specified by:
decodein interfacecom.mojang.serialization.Decoder<T>
-
encode
public <T1> com.mojang.serialization.DataResult<T1> encode(T input, com.mojang.serialization.DynamicOps<T1> ops, T1 prefix) - Specified by:
encodein interfacecom.mojang.serialization.Encoder<T>
-