Package net.minecraft.tags
Record Class TagKey<T>
java.lang.Object
java.lang.Record
net.minecraft.tags.TagKey<T>
public record TagKey<T>(ResourceKey<? extends Registry<T>> registry, ResourceLocation location)
extends Record
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final ResourceLocation
The field for thelocation
record component.private final ResourceKey<? extends Registry<T>>
The field for theregistry
record component.private static final com.google.common.collect.Interner<TagKey<?>>
-
Constructor Summary
ConstructorsConstructorDescriptionTagKey
(ResourceKey<? extends Registry<T>> registry, ResourceLocation location) Creates an instance of aTagKey
record class. -
Method Summary
Modifier and TypeMethodDescriptioncast
(ResourceKey<? extends Registry<E>> p_207648_) static <T> com.mojang.serialization.Codec<TagKey<T>>
codec
(ResourceKey<? extends Registry<T>> p_203878_) static <T> TagKey<T>
create
(ResourceKey<? extends Registry<T>> p_203883_, ResourceLocation p_203884_) final boolean
Indicates whether some other object is "equal to" this one.final int
hashCode()
Returns a hash code value for this object.static <T> com.mojang.serialization.Codec<TagKey<T>>
hashedCodec
(ResourceKey<? extends Registry<T>> p_203887_) boolean
isFor
(ResourceKey<? extends Registry<?>> p_207646_) location()
Returns the value of thelocation
record component.ResourceKey<? extends Registry<T>>
registry()
Returns the value of theregistry
record component.toString()
Returns a string representation of this record class.
-
Field Details
-
registry
The field for theregistry
record component. -
location
The field for thelocation
record component. -
VALUES
-
-
Constructor Details
-
TagKey
Creates an instance of aTagKey
record class.- Parameters:
registry
- the value for theregistry
record componentlocation
- the value for thelocation
record component
-
-
Method Details
-
codec
public static <T> com.mojang.serialization.Codec<TagKey<T>> codec(ResourceKey<? extends Registry<T>> p_203878_) -
hashedCodec
public static <T> com.mojang.serialization.Codec<TagKey<T>> hashedCodec(ResourceKey<? extends Registry<T>> p_203887_) -
create
public static <T> TagKey<T> create(ResourceKey<? extends Registry<T>> p_203883_, ResourceLocation p_203884_) -
isFor
-
cast
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
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)
. -
registry
Returns the value of theregistry
record component.- Returns:
- the value of the
registry
record component
-
location
Returns the value of thelocation
record component.- Returns:
- the value of the
location
record component
-