CLASS net/minecraft/class_6880 net/minecraft/util/registry/RegistryEntry COMMENT An object holding a value that can be registered in a registry. In most cases, the COMMENT value is already registered in a registry ("reference entry"), hence the name; COMMENT however, it is possible to create a registry entry by direct reference COMMENT ("direct entry"). This is useful for data packs, as they can define COMMENT one-time use values directly without having to register them every time. COMMENT COMMENT
Registry entries do not define {@code equals} method. Instead, compare the result COMMENT of {@link #getKeyOrValue}. COMMENT COMMENT
Reference registry entries also hold their {@linkplain TagKey tags}. For more COMMENT information on type-specific behaviors, including "intrusive" and "stand-alone" COMMENT reference registry entries, see the respective class documentations. COMMENT COMMENT
A registry entry is sometimes referred to as a "holder" in error messages. COMMENT COMMENT @see RegistryEntry.Direct COMMENT @see RegistryEntry.Reference COMMENT @see Registry#entryOf COMMENT @see Registry#getEntry METHOD method_40220 isIn (Lnet/minecraft/class_6862;)Z COMMENT {@return whether this entry is in {@code tag}} COMMENT COMMENT
This always returns {@code false} for direct entries, since tags are managed by
COMMENT a registry.
ARG 1 tag
METHOD method_40221 upcast (Lnet/minecraft/class_6880;)Lnet/minecraft/class_6880;
COMMENT Casts {@code RegistryEntry extends T>} to {@code RegistryEntry This always returns {@code true} for direct entries.
ARG 1 registry
METHOD method_40223 of (Ljava/lang/Object;)Lnet/minecraft/class_6880;
COMMENT {@return a new direct registry entry of {@code value}}
ARG 0 value
METHOD method_40224 matches (Ljava/util/function/Predicate;)Z
COMMENT {@return whether this entry's key matches {@code predicate}}
COMMENT
COMMENT This always returns {@code false} for direct entries.
ARG 1 predicate
METHOD method_40225 matchesKey (Lnet/minecraft/class_5321;)Z
COMMENT {@return whether the registry key of this entry is {@code key}}
COMMENT
COMMENT This always returns {@code false} for direct entries.
ARG 1 key
METHOD method_40226 matchesId (Lnet/minecraft/class_2960;)Z
COMMENT {@return whether the ID of this entry is {@code id}}
COMMENT
COMMENT This always returns {@code false} for direct entries.
ARG 1 id
METHOD method_40227 hasKeyAndValue ()Z
METHOD method_40228 streamTags ()Ljava/util/stream/Stream;
COMMENT {@return a stream of the tags of this entry, or an empty stream if this is a direct entry}
METHOD method_40229 getKeyOrValue ()Lcom/mojang/datafixers/util/Either;
COMMENT {@return the object that identifies this registry key}
COMMENT
COMMENT For direct entries, this is the held value, and for reference entries, this is the
COMMENT key of the entry.
METHOD method_40230 getKey ()Ljava/util/Optional;
COMMENT {@return the registry key of this entry, or an empty optional if this is a direct entry}
METHOD method_40231 getType ()Lnet/minecraft/class_6880$class_6882;
COMMENT {@return the type (direct or reference) of this registry entry}
COMMENT
COMMENT This is different from the types of reference registry entries, i.e.
COMMENT stand-alone or intrusive.
CLASS class_6881 Direct
COMMENT A direct registry entry holds the value directly. The value does not have to be
COMMENT registered in a registry. Therefore, they receive no ID or registry key, and they
COMMENT cannot be tagged.
COMMENT
COMMENT This is most often used in data packs to inline one-time use values directly.
CLASS class_6882 Type
COMMENT The types of registry entries.
COMMENT
COMMENT @see RegistryEntry
CLASS class_6883 Reference
COMMENT A reference registry entry holds the value by reference. The value is previously
COMMENT registered in a registry, so they can be referred to by their registry keys.
COMMENT This object also holds the entry's tags.
COMMENT
COMMENT There are two types of reference registry entries.
COMMENT
COMMENT Therefore, it is very important to construct any intrusive-entry type object
COMMENT and register at the same time. For example, a mod that conditionally registers an
COMMENT {@link Item} has to create an instance only if the condition is met. (See {@link Registry}
COMMENT for a code example.)
COMMENT
COMMENT When a reference registry entry is first instantiated, it only has either the key
COMMENT or the value (depending on the type). They are later filled when registering the
COMMENT entry at {@link #setKeyAndValue}. Attempting to call methods before those fields are filled
COMMENT can cause a crash. Note that if you are just getting the entry from a registry, this
COMMENT should not be a problem.
COMMENT
COMMENT @see Registry#entryOf
COMMENT @see Registry#getEntry
FIELD field_36449 registry Lnet/minecraft/class_2378;
FIELD field_36450 tags Ljava/util/Set;
FIELD field_36451 referenceType Lnet/minecraft/class_6880$class_6883$class_6884;
FIELD field_36452 registryKey Lnet/minecraft/class_5321;
FIELD field_36453 value Ljava/lang/Object;
METHOD This should not be called manually. Call {@link Registry#entryOf} or
COMMENT {@link Registry#getEntry} instead.
COMMENT
COMMENT Callers are responsible for filling the key later by calling {@link
COMMENT #setKeyAndValue}.
COMMENT
COMMENT @deprecated Intrusive holders exist for legacy reasons only.
ARG 0 registry
ARG 1 value
METHOD method_40234 standAlone (Lnet/minecraft/class_2378;Lnet/minecraft/class_5321;)Lnet/minecraft/class_6880$class_6883;
COMMENT {@return a new stand-alone registry entry}
COMMENT
COMMENT This should not be called manually. Call {@link Registry#entryOf} or
COMMENT {@link Registry#getEntry} instead.
COMMENT
COMMENT Callers are responsible for filling the value later by calling {@link
COMMENT #setKeyAndValue}.
ARG 0 registry
ARG 1 registryKey
METHOD method_40235 setTags (Ljava/util/Collection;)V
ARG 1 tags
METHOD method_40236 setKeyAndValue (Lnet/minecraft/class_5321;Ljava/lang/Object;)V
COMMENT Sets the key and the value of this registry entry. When instantiated, an entry has
COMMENT only one of them, and this is called to fill the other value. Pass the current value
COMMENT for the parameter corresponding to the already filled field.
COMMENT
COMMENT @throws IllegalStateException when trying to change already filled fields
ARG 1 key
ARG 2 value
METHOD method_40237 registryKey ()Lnet/minecraft/class_5321;
COMMENT {@return the registry key of this entry}
COMMENT
COMMENT @throws IllegalStateException if this is an intrusive entry and it is not initialized yet
CLASS class_6884 Type
COMMENT The types of reference registry entries.
COMMENT
COMMENT @see RegistryEntry.Reference
COMMENT
COMMENT
COMMENT