Package net.minecraft.util
Class ExtraCodecs
java.lang.Object
net.minecraft.util.ExtraCodecs
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic final class
(package private) static class
(package private) static final class
static final record
static final record
(package private) static final record
-
Field Summary
Modifier and TypeFieldDescriptionstatic final com.mojang.serialization.Codec<org.joml.AxisAngle4f>
static final com.mojang.serialization.Codec<byte[]>
static final com.mojang.serialization.Codec<BitSet>
static final com.mojang.serialization.Codec<Integer>
static final com.mojang.serialization.Codec<String>
static final com.mojang.serialization.Codec<com.google.gson.JsonElement>
static final Function<OptionalLong,
Optional<Long>> static final com.mojang.serialization.Codec<com.mojang.authlib.GameProfile>
private static final com.mojang.serialization.MapCodec<com.mojang.authlib.GameProfile>
static final com.mojang.serialization.Codec<Instant>
static final com.mojang.serialization.Codec<Object>
static final com.mojang.serialization.Codec<com.google.gson.JsonElement>
static com.mojang.serialization.Codec<org.joml.Matrix4f>
static final com.mojang.serialization.Codec<String>
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<org.joml.Quaternionf>
static final com.mojang.serialization.Codec<org.joml.Quaternionf>
static com.mojang.serialization.Codec<String>
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_) static <T> com.mojang.serialization.Codec<T>
converter
(com.mojang.serialization.DynamicOps<T> p_310943_) static <K,
V> com.mojang.serialization.MapCodec<V> dispatchOptionalValue
(String p_311089_, String p_310965_, com.mojang.serialization.Codec<K> p_310912_, Function<? super V, ? extends K> p_311760_, Function<? super K, ? extends com.mojang.serialization.Codec<? extends V>> p_312960_) Deprecated.static <F,
S> ExtraCodecs.EitherCodec<F, S> either
(com.mojang.serialization.Codec<F> p_298040_, com.mojang.serialization.Codec<S> p_300729_) 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 <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_) static com.mojang.serialization.Codec<Integer>
intRange
(int p_270883_, int p_270323_) 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_) 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 <T> com.mojang.serialization.Codec<it.unimi.dsi.fastutil.objects.Object2BooleanMap<T>>
object2BooleanMap
(com.mojang.serialization.Codec<T> p_300841_) static <E> com.mojang.serialization.Codec<E>
orCompressed
(com.mojang.serialization.Codec<E> p_184426_, com.mojang.serialization.Codec<E> p_184427_) static <E> com.mojang.serialization.MapCodec<E>
orCompressed
(com.mojang.serialization.MapCodec<E> p_311419_, com.mojang.serialization.MapCodec<E> p_312369_) 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 <T> com.mojang.serialization.Codec<T>
recursive
(String p_312059_, Function<com.mojang.serialization.Codec<T>, com.mojang.serialization.Codec<T>> p_298069_) static <E> com.mojang.serialization.MapCodec<E>
retrieveContext
(Function<com.mojang.serialization.DynamicOps<?>, com.mojang.serialization.DataResult<E>> p_203977_) static com.mojang.serialization.Codec<String>
sizeLimitedString
(int p_265773_, int p_265217_) static <A> com.mojang.serialization.MapCodec<Optional<A>>
strictOptionalField
(com.mojang.serialization.Codec<A> p_298284_, String p_297262_) static <A> com.mojang.serialization.MapCodec<A>
strictOptionalField
(com.mojang.serialization.Codec<A> p_298122_, String p_301181_, A p_300795_) static <K,
V> ExtraCodecs.StrictUnboundedMapCodec<K, V> strictUnboundedMap
(com.mojang.serialization.Codec<K> p_298880_, com.mojang.serialization.Codec<V> p_297369_) static <E> com.mojang.serialization.Codec<E>
stringResolverCodec
(Function<E, String> p_184406_, Function<String, E> p_184407_) static com.mojang.serialization.Codec<TemporalAccessor>
temporalCodec
(DateTimeFormatter p_216171_) static <T> com.mojang.serialization.Codec<T>
validate
(com.mojang.serialization.Codec<T> p_265690_, Function<T, com.mojang.serialization.DataResult<T>> p_265223_) static <T> com.mojang.serialization.MapCodec<T>
validate
(com.mojang.serialization.MapCodec<T> p_286613_, Function<T, com.mojang.serialization.DataResult<T>> p_286875_) static <T> com.mojang.serialization.Codec<T>
withAlternative
(com.mojang.serialization.Codec<T> p_300585_, com.mojang.serialization.Codec<? extends T> p_300484_) static <T,
U> com.mojang.serialization.Codec<T> withAlternative
(com.mojang.serialization.Codec<T> p_299945_, com.mojang.serialization.Codec<U> p_299401_, Function<U, T> p_297361_) 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 -
JAVA
-
FLAT_JSON
public static final com.mojang.serialization.Codec<com.google.gson.JsonElement> FLAT_JSON -
VECTOR3F
public static final com.mojang.serialization.Codec<org.joml.Vector3f> VECTOR3F -
QUATERNIONF_COMPONENTS
public static final com.mojang.serialization.Codec<org.joml.Quaternionf> QUATERNIONF_COMPONENTS -
AXISANGLE4F
public static final com.mojang.serialization.Codec<org.joml.AxisAngle4f> AXISANGLE4F -
QUATERNIONF
public static final com.mojang.serialization.Codec<org.joml.Quaternionf> QUATERNIONF -
MATRIX4F
public static com.mojang.serialization.Codec<org.joml.Matrix4f> MATRIX4F -
NON_NEGATIVE_INT
-
POSITIVE_INT
-
POSITIVE_FLOAT
-
PATTERN
-
INSTANT_ISO8601
-
BASE64_STRING
public static final com.mojang.serialization.Codec<byte[]> BASE64_STRING -
ESCAPED_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_WITHOUT_PROPERTIES
private static final com.mojang.serialization.MapCodec<com.mojang.authlib.GameProfile> GAME_PROFILE_WITHOUT_PROPERTIES -
GAME_PROFILE
public static final com.mojang.serialization.Codec<com.mojang.authlib.GameProfile> GAME_PROFILE -
NON_EMPTY_STRING
-
CODEPOINT
-
RESOURCE_PATH_CODEC
-
-
Constructor Details
-
ExtraCodecs
public ExtraCodecs()
-
-
Method Details
-
converter
public static <T> com.mojang.serialization.Codec<T> converter(com.mojang.serialization.DynamicOps<T> p_310943_) -
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_) -
orCompressed
public static <E> com.mojang.serialization.MapCodec<E> orCompressed(com.mojang.serialization.MapCodec<E> p_311419_, com.mojang.serialization.MapCodec<E> p_312369_) -
overrideLifecycle
-
either
public static <F,S> ExtraCodecs.EitherCodec<F,S> either(com.mojang.serialization.Codec<F> p_298040_, com.mojang.serialization.Codec<S> p_300729_) -
strictUnboundedMap
public static <K,V> ExtraCodecs.StrictUnboundedMapCodec<K,V> strictUnboundedMap(com.mojang.serialization.Codec<K> p_298880_, com.mojang.serialization.Codec<V> p_297369_) -
validate
public static <T> com.mojang.serialization.Codec<T> validate(com.mojang.serialization.Codec<T> p_265690_, Function<T, com.mojang.serialization.DataResult<T>> p_265223_) -
validate
public static <T> com.mojang.serialization.MapCodec<T> validate(com.mojang.serialization.MapCodec<T> p_286613_, Function<T, com.mojang.serialization.DataResult<T>> p_286875_) -
intRangeWithMessage
-
intRange
-
floatRangeMinExclusiveWithMessage
-
nonEmptyList
-
nonEmptyHolderSet
-
recursive
-
lazyInitializedCodec
public static <A> com.mojang.serialization.Codec<A> lazyInitializedCodec(Supplier<com.mojang.serialization.Codec<A>> p_184416_) -
strictOptionalField
-
strictOptionalField
public static <A> com.mojang.serialization.MapCodec<A> strictOptionalField(com.mojang.serialization.Codec<A> p_298122_, String p_301181_, A p_300795_) -
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_) -
temporalCodec
public static com.mojang.serialization.Codec<TemporalAccessor> temporalCodec(DateTimeFormatter p_216171_) -
asOptionalLong
public static com.mojang.serialization.MapCodec<OptionalLong> asOptionalLong(com.mojang.serialization.MapCodec<Optional<Long>> p_216167_) -
sizeLimitedString
public static com.mojang.serialization.Codec<String> sizeLimitedString(int p_265773_, int p_265217_) -
withAlternative
public static <T> com.mojang.serialization.Codec<T> withAlternative(com.mojang.serialization.Codec<T> p_300585_, com.mojang.serialization.Codec<? extends T> p_300484_) -
withAlternative
public static <T,U> com.mojang.serialization.Codec<T> withAlternative(com.mojang.serialization.Codec<T> p_299945_, com.mojang.serialization.Codec<U> p_299401_, Function<U, T> p_297361_) -
object2BooleanMap
public static <T> com.mojang.serialization.Codec<it.unimi.dsi.fastutil.objects.Object2BooleanMap<T>> object2BooleanMap(com.mojang.serialization.Codec<T> p_300841_) -
dispatchOptionalValue
@Deprecated public static <K,V> com.mojang.serialization.MapCodec<V> dispatchOptionalValue(String p_311089_, String p_310965_, com.mojang.serialization.Codec<K> p_310912_, Function<? super V, ? extends K> p_311760_, Function<? super K, ? extends com.mojang.serialization.Codec<? extends V>> p_312960_) Deprecated.
-