Class MapCodec<A>
java.lang.Object
com.mojang.serialization.CompressorHolder
com.mojang.serialization.MapCodec<A>
- All Implemented Interfaces:
Compressable, Keyable, MapDecoder<A>, MapEncoder<A>
- Direct Known Subclasses:
ComponentSerialization.FuzzyCodec, ComponentSerialization.StrictEither, EitherMapCodec, KeyDispatchCodec, MapCodec.Dependent, MapCodec.RecursiveMapCodec, NeoForgeExtraCodecs.AlternativeMapCodec, NeoForgeExtraCodecs.XorMapCodec, OptionalFieldCodec, PairMapCodec, SimpleMapCodec
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static classstatic final recordprivate static classstatic interfaceNested classes/interfaces inherited from interface MapDecoder
MapDecoder.Implementation<A>Nested classes/interfaces inherited from interface MapEncoder
MapEncoder.Implementation<A> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <A> MapCodec<A> assumeMapUnsafe(Codec<A> codec) codec()dependent(MapCodec<E> initialInstance, Function<A, Pair<E, MapCodec<E>>> splitter, BiFunction<A, E, A> combiner) deprecated(int since) <E> Codec<E> dispatch(Function<? super E, ? extends A> type, Function<? super A, ? extends MapCodec<? extends E>> codec) <E> MapCodec<E> dispatchMap(Function<? super E, ? extends A> type, Function<? super A, ? extends MapCodec<? extends E>> codec) <E> Codec<E> dispatchStable(Function<? super E, ? extends A> type, Function<? super A, ? extends MapCodec<? extends E>> codec) <S> MapCodec<S> flatXmap(Function<? super A, ? extends DataResult<? extends S>> to, Function<? super S, ? extends DataResult<? extends A>> from) final <O> RecordCodecBuilder<O, A> abstract <T> Stream<T> keys(DynamicOps<T> ops) mapResult(MapCodec.ResultFunction<A> function) static <A> MapCodec<A> of(MapEncoder<A> encoder, MapDecoder<A> decoder) static <A> MapCodec<A> of(MapEncoder<A> encoder, MapDecoder<A> decoder, Supplier<String> name) orElse(UnaryOperator<String> onError, A value) orElseGet(UnaryOperator<String> onError, Supplier<? extends A> value) <E> Codec<E> partialDispatch(Function<? super E, ? extends DataResult<? extends A>> type, Function<? super A, ? extends DataResult<? extends MapCodec<? extends E>>> codec) static <A> MapCodec<A> setPartial(Supplier<A> value) stable()static <A> MapCodec<A> unit(A defaultValue) static <A> MapCodec<A> static <A> Codec<A> unitCodec(A value) static <A> Codec<A> Replacement forMapCodec.MapCodecCodecthat does not allocate new builder, but otherwise has same effect of containing structure.validate(Function<A, DataResult<A>> checker) withLifecycle(Lifecycle lifecycle) <S> MapCodec<S> Methods inherited from class CompressorHolder
compressorMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface MapDecoder
ap, compressedDecode, compressor, decode, decoder, flatMap, mapMethods inherited from interface MapEncoder
comap, compressedBuilder, compressor, encode, encoder, flatComap
-
Constructor Details
-
MapCodec
public MapCodec()
-
-
Method Details
-
assumeMapUnsafe
-
forGetter
-
of
-
of
public static <A> MapCodec<A> of(MapEncoder<A> encoder, MapDecoder<A> decoder, Supplier<String> name) -
recursive
-
fieldOf
-
withLifecycle
- Specified by:
withLifecyclein interfaceMapDecoder<A>- Specified by:
withLifecyclein interfaceMapEncoder<A>
-
codec
-
stable
-
deprecated
-
xmap
-
flatXmap
public <S> MapCodec<S> flatXmap(Function<? super A, ? extends DataResult<? extends S>> to, Function<? super S, ? extends DataResult<? extends A>> from) -
validate
-
dependent
-
dispatch
-
dispatchStable
-
partialDispatch
public <E> Codec<E> partialDispatch(Function<? super E, ? extends DataResult<? extends A>> type, Function<? super A, ? extends DataResult<? extends MapCodec<? extends E>>> codec) -
dispatchMap
-
keys
-
mapResult
-
orElse
-
orElse
-
orElseGet
-
orElseGet
-
orElse
-
orElseGet
-
setPartial
-
unit
-
unit
-
unitCodec
-
unitCodec
Replacement forMapCodec.MapCodecCodecthat does not allocate new builder, but otherwise has same effect of containing structure. Value will be represented asDynamicOps.emptyMap()
-