Record Class DataType<T>
java.lang.Object
java.lang.Record
dev.latvian.mods.klib.data.DataType<T>
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncom.mojang.brigadier.arguments.ArgumentType<?> argument(net.minecraft.commands.CommandBuildContext ctx) com.mojang.serialization.Codec<T> codec()Returns the value of thecodecrecord component.@Nullable DataType<?> Returns the value of thecomponentTyperecord component.static <L,R> DataType <com.mojang.datafixers.util.Either<L, R>> static <T,L, R> DataType <T> either(DataType<L> left, DataType<R> right, Function<L, T> leftTo, Function<R, T> rightTo, Function<T, com.mojang.datafixers.util.Either<L, R>> from) Returns the value of theenumValuesrecord component.booleanIndicates whether some other object is "equal to" this one.get(com.mojang.brigadier.context.CommandContext<net.minecraft.commands.CommandSourceStack> ctx, String name) inthashCode()Returns a hash code value for this object.@Nullable net.minecraft.resources.ResourceKey<DataType<?>> key()listOf()static <T> DataType<T> of(com.mojang.serialization.Codec<T> codec, net.minecraft.network.codec.StreamCodec<? super net.minecraft.network.RegistryFriendlyByteBuf, T> streamCodec) static <T> DataType<T> of(com.mojang.serialization.Codec<T> codec, net.minecraft.network.codec.StreamCodec<? super net.minecraft.network.RegistryFriendlyByteBuf, T> streamCodec, List<Map.Entry<String, T>> enumValues) static <E> DataType<E> of(E[] values) static <E> DataType<E> of(E[] values, @Nullable NameProvider<E> nameProvider) static <T> DataType<net.minecraft.resources.ResourceKey<T>> of(net.minecraft.resources.ResourceKey<? extends net.minecraft.core.Registry<T>> registry) net.minecraft.resources.ResourceKey<DataType<?>> setOf()net.minecraft.network.codec.StreamCodec<? super net.minecraft.network.RegistryFriendlyByteBuf, T> Returns the value of thestreamCodecrecord component.@Nullable NumbertoString()Returns a string representation of this record class.static <C, T extends C>
DataType<C> unit(T value)
-
Field Details
-
REGISTRY_KEYS
-
-
Constructor Details
-
DataType
public DataType(com.mojang.serialization.Codec<T> codec, net.minecraft.network.codec.StreamCodec<? super net.minecraft.network.RegistryFriendlyByteBuf, T> streamCodec, List<Map.Entry<String, T>> enumValues, DataType<?> componentType) Creates an instance of aDataTyperecord class.- Parameters:
codec- the value for thecodecrecord componentstreamCodec- the value for thestreamCodecrecord componentenumValues- the value for theenumValuesrecord componentcomponentType- the value for thecomponentTyperecord component
-
-
Method Details
-
of
-
of
public static <T> DataType<T> of(com.mojang.serialization.Codec<T> codec, net.minecraft.network.codec.StreamCodec<? super net.minecraft.network.RegistryFriendlyByteBuf, T> streamCodec) -
of
-
of
-
of
public static <T> DataType<net.minecraft.resources.ResourceKey<T>> of(net.minecraft.resources.ResourceKey<? extends net.minecraft.core.Registry<T>> registry) -
unit
-
either
-
either
-
listOf
-
setOf
-
toNumber
-
key
-
requireKey
-
hashCode
-
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. All components in this record class are compared withObjects::equals(Object,Object). -
toString
-
argument
public com.mojang.brigadier.arguments.ArgumentType<?> argument(net.minecraft.commands.CommandBuildContext ctx) -
get
-
codec
Returns the value of thecodecrecord component.- Returns:
- the value of the
codecrecord component
-
streamCodec
public net.minecraft.network.codec.StreamCodec<? super net.minecraft.network.RegistryFriendlyByteBuf, T> streamCodec()Returns the value of thestreamCodecrecord component.- Returns:
- the value of the
streamCodecrecord component
-
enumValues
-
componentType
Returns the value of thecomponentTyperecord component.- Returns:
- the value of the
componentTyperecord component
-