Package net.minecraft.util
Class ExtraCodecs
java.lang.Object
net.minecraft.util.ExtraCodecs
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic final class
(package private) static final record
static final record
(package private) static final class
-
Field Summary
Modifier and TypeFieldDescriptionstatic final com.mojang.serialization.Codec<byte[]>
static final com.mojang.serialization.Codec<BitSet>
static final com.mojang.serialization.Codec<Component>
static final Function<OptionalLong,
Optional<Long>> static final com.mojang.serialization.Codec<com.mojang.authlib.GameProfile>
static final com.mojang.serialization.Codec<Instant>
static final com.mojang.serialization.Codec<com.google.gson.JsonElement>
static final com.mojang.serialization.Codec<Integer>
static final com.mojang.serialization.Codec<Pattern>
static final com.mojang.serialization.Codec<Float>
static final com.mojang.serialization.Codec<Integer>
private static final com.mojang.serialization.Codec<com.mojang.authlib.properties.Property>
static final com.mojang.serialization.Codec<com.mojang.authlib.properties.PropertyMap>
static final com.mojang.serialization.Codec<ExtraCodecs.TagOrElementLocation>
static final Function<Optional<Long>,
OptionalLong> static final com.mojang.serialization.Codec<org.joml.Vector3f>
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic com.mojang.serialization.MapCodec<OptionalLong>
asOptionalLong
(com.mojang.serialization.MapCodec<Optional<Long>> p_216167_) static <A> com.mojang.serialization.Codec<A>
catchDecoderException
(com.mojang.serialization.Codec<A> p_216186_) private static <N extends Number & Comparable<N>>
Function<N,com.mojang.serialization.DataResult<N>> checkRangeMinExclusiveWithMessage
(N p_184431_, N p_184432_, Function<N, String> p_184433_) private static <N extends Number & Comparable<N>>
Function<N,com.mojang.serialization.DataResult<N>> checkRangeWithMessage
(N p_144645_, N p_144646_, Function<N, String> p_144647_) static <E,
L extends Collection<E>, T>
Function<L,com.mojang.serialization.DataResult<L>> ensureHomogenous
(Function<E, T> p_203985_) private static com.mojang.serialization.Codec<Float>
floatRangeMinExclusiveWithMessage
(float p_184351_, float p_184352_, Function<Float, String> p_184353_) static <E> com.mojang.serialization.Codec<E>
idResolverCodec
(ToIntFunction<E> p_184422_, IntFunction<E> p_184423_, int p_184424_) static com.mojang.serialization.Codec<Instant>
instantCodec
(DateTimeFormatter p_216171_) static <P,
I> com.mojang.serialization.Codec<I> intervalCodec
(com.mojang.serialization.Codec<P> p_184362_, String p_184363_, String p_184364_, BiFunction<P, P, com.mojang.serialization.DataResult<I>> p_184365_, Function<I, P> p_184366_, Function<I, P> p_184367_) private static com.mojang.serialization.Codec<Integer>
intRangeWithMessage
(int p_144634_, int p_144635_, Function<Integer, String> p_144636_) static <A> com.mojang.serialization.Codec<A>
lazyInitializedCodec
(Supplier<com.mojang.serialization.Codec<A>> p_184416_) private static com.mojang.serialization.DataResult<com.mojang.datafixers.util.Pair<Optional<UUID>,
Optional<String>>> mapGameProfileToIdName
(com.mojang.authlib.GameProfile p_254220_) private static com.mojang.serialization.DataResult<com.mojang.authlib.GameProfile>
mapIdNameToGameProfile
(com.mojang.datafixers.util.Pair<Optional<UUID>, Optional<String>> p_253764_) static <T> com.mojang.serialization.Codec<HolderSet<T>>
nonEmptyHolderSet
(com.mojang.serialization.Codec<HolderSet<T>> p_203983_) static <T> com.mojang.serialization.Codec<List<T>>
nonEmptyList
(com.mojang.serialization.Codec<List<T>> p_144638_) static <E> com.mojang.serialization.Codec<E>
orCompressed
(com.mojang.serialization.Codec<E> p_184426_, com.mojang.serialization.Codec<E> p_184427_) static <A> com.mojang.serialization.Codec.ResultFunction<A>
orElsePartial
(A p_184382_) static <E> com.mojang.serialization.Codec<E>
overrideLifecycle
(com.mojang.serialization.Codec<E> p_184369_, Function<E, com.mojang.serialization.Lifecycle> p_184370_, Function<E, com.mojang.serialization.Lifecycle> p_184371_) static <E> com.mojang.serialization.MapCodec<E>
retrieveContext
(Function<com.mojang.serialization.DynamicOps<?>, com.mojang.serialization.DataResult<E>> p_203977_) static <E> com.mojang.serialization.Codec<E>
stringResolverCodec
(Function<E, String> p_184406_, Function<String, E> p_184407_) static <F,
S> com.mojang.serialization.Codec<com.mojang.datafixers.util.Either<F, S>> xor
(com.mojang.serialization.Codec<F> p_144640_, com.mojang.serialization.Codec<S> p_144641_)
-
Field Details
-
JSON
public static final com.mojang.serialization.Codec<com.google.gson.JsonElement> JSON -
COMPONENT
-
VECTOR3F
public static final com.mojang.serialization.Codec<org.joml.Vector3f> VECTOR3F -
NON_NEGATIVE_INT
-
POSITIVE_INT
-
POSITIVE_FLOAT
-
PATTERN
-
INSTANT_ISO8601
-
BASE64_STRING
public static final com.mojang.serialization.Codec<byte[]> BASE64_STRING -
TAG_OR_ELEMENT_ID
public static final com.mojang.serialization.Codec<ExtraCodecs.TagOrElementLocation> TAG_OR_ELEMENT_ID -
toOptionalLong
-
fromOptionalLong
-
BIT_SET
-
PROPERTY
private static final com.mojang.serialization.Codec<com.mojang.authlib.properties.Property> PROPERTY -
PROPERTY_MAP
public static final com.mojang.serialization.Codec<com.mojang.authlib.properties.PropertyMap> PROPERTY_MAP -
GAME_PROFILE
public static final com.mojang.serialization.Codec<com.mojang.authlib.GameProfile> GAME_PROFILE
-
-
Constructor Details
-
ExtraCodecs
public ExtraCodecs()
-
-
Method Details
-
xor
public static <F,S> com.mojang.serialization.Codec<com.mojang.datafixers.util.Either<F,S>> xor(com.mojang.serialization.Codec<F> p_144640_, com.mojang.serialization.Codec<S> p_144641_) -
intervalCodec
public static <P,I> com.mojang.serialization.Codec<I> intervalCodec(com.mojang.serialization.Codec<P> p_184362_, String p_184363_, String p_184364_, BiFunction<P, P, com.mojang.serialization.DataResult<I>> p_184365_, Function<I, P> p_184366_, Function<I, P> p_184367_) -
orElsePartial
public static <A> com.mojang.serialization.Codec.ResultFunction<A> orElsePartial(A p_184382_) -
idResolverCodec
public static <E> com.mojang.serialization.Codec<E> idResolverCodec(ToIntFunction<E> p_184422_, IntFunction<E> p_184423_, int p_184424_) -
stringResolverCodec
-
orCompressed
public static <E> com.mojang.serialization.Codec<E> orCompressed(com.mojang.serialization.Codec<E> p_184426_, com.mojang.serialization.Codec<E> p_184427_) -
overrideLifecycle
-
checkRangeWithMessage
private static <N extends Number & Comparable<N>> Function<N,com.mojang.serialization.DataResult<N>> checkRangeWithMessage(N p_144645_, N p_144646_, Function<N, String> p_144647_) -
intRangeWithMessage
-
checkRangeMinExclusiveWithMessage
private static <N extends Number & Comparable<N>> Function<N,com.mojang.serialization.DataResult<N>> checkRangeMinExclusiveWithMessage(N p_184431_, N p_184432_, Function<N, String> p_184433_) -
floatRangeMinExclusiveWithMessage
-
nonEmptyListCheck
-
nonEmptyList
-
nonEmptyHolderSetCheck
-
nonEmptyHolderSet
-
lazyInitializedCodec
public static <A> com.mojang.serialization.Codec<A> lazyInitializedCodec(Supplier<com.mojang.serialization.Codec<A>> p_184416_) -
retrieveContext
public static <E> com.mojang.serialization.MapCodec<E> retrieveContext(Function<com.mojang.serialization.DynamicOps<?>, com.mojang.serialization.DataResult<E>> p_203977_) -
ensureHomogenous
public static <E,L extends Collection<E>, Function<L,T> com.mojang.serialization.DataResult<L>> ensureHomogenous(Function<E, T> p_203985_) -
catchDecoderException
public static <A> com.mojang.serialization.Codec<A> catchDecoderException(com.mojang.serialization.Codec<A> p_216186_) -
instantCodec
-
asOptionalLong
public static com.mojang.serialization.MapCodec<OptionalLong> asOptionalLong(com.mojang.serialization.MapCodec<Optional<Long>> p_216167_) -
mapIdNameToGameProfile
-
mapGameProfileToIdName
-