Interface RegistryEntry<T>
- All Known Implementing Classes:
RegistryEntry.Direct,RegistryEntry.Reference
Registry entries do not define equals method. Instead, compare the result
of getKeyOrValue().
Reference registry entries also hold their tags. For more information on type-specific behaviors, including "intrusive" and "stand-alone" reference registry entries, see the respective class documentations.
A registry entry is sometimes referred to as a "holder" in error messages.
- See Also:
- Mappings:
Namespace Name official haintermediary net/minecraft/class_6880named net/minecraft/util/registry/RegistryEntry
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic final recordA direct registry entry holds the value directly.static classA reference registry entry holds the value by reference.static enumThe types of registry entries. -
Method Summary
Modifier and TypeMethodDescriptiongetKey()Returns the registry key of this entry, or an empty optional if this is a direct entry.com.mojang.datafixers.util.Either<RegistryKey<T>,T> Returns the object that identifies this registry key.getType()Returns the type (direct or reference) of this registry entry.booleanbooleanReturns whether this entry is intag.booleanmatches(Predicate<RegistryKey<T>> predicate) Returns whether this entry's key matchespredicate.booleanmatchesId(Identifier id) Returns whether the ID of this entry isid.booleanmatchesKey(RegistryKey<T> key) Returns whether the registry key of this entry iskey.booleanmatchesRegistry(Registry<T> registry) Returns whether the registry for the entry isregistry.static <T> RegistryEntry<T>of(T value) Returns a new direct registry entry ofvalue.Returns a stream of the tags of this entry, or an empty stream if this is a direct entry.static <T> RegistryEntry<T>upcast(RegistryEntry<? extends T> entry) CastsRegistryEntry<? extends T>toRegistryEntry<T>.value()
-
Method Details
-
value
T value()- Mappings:
Namespace Name Mixin selector official aLha;a()Ljava/lang/Object;intermediary comp_349Lnet/minecraft/class_6880;comp_349()Ljava/lang/Object;named valueLnet/minecraft/util/registry/RegistryEntry;value()Ljava/lang/Object;
-
hasKeyAndValue
boolean hasKeyAndValue()- Mappings:
Namespace Name Mixin selector official bLha;b()Zintermediary method_40227Lnet/minecraft/class_6880;method_40227()Znamed hasKeyAndValueLnet/minecraft/util/registry/RegistryEntry;hasKeyAndValue()Z
-
matchesId
Returns whether the ID of this entry isid.This always returns
falsefor direct entries.- Returns:
- whether the ID of this entry is
id - Mappings:
Namespace Name Mixin selector official aLha;a(Labv;)Zintermediary method_40226Lnet/minecraft/class_6880;method_40226(Lnet/minecraft/class_2960;)Znamed matchesIdLnet/minecraft/util/registry/RegistryEntry;matchesId(Lnet/minecraft/util/Identifier;)Z
-
matchesKey
Returns whether the registry key of this entry iskey.This always returns
falsefor direct entries.- Returns:
- whether the registry key of this entry is
key - Mappings:
Namespace Name Mixin selector official aLha;a(Labu;)Zintermediary method_40225Lnet/minecraft/class_6880;method_40225(Lnet/minecraft/class_5321;)Znamed matchesKeyLnet/minecraft/util/registry/RegistryEntry;matchesKey(Lnet/minecraft/util/registry/RegistryKey;)Z
-
matches
Returns whether this entry's key matchespredicate.This always returns
falsefor direct entries.- Returns:
- whether this entry's key matches
predicate - Mappings:
Namespace Name Mixin selector official aLha;a(Ljava/util/function/Predicate;)Zintermediary method_40224Lnet/minecraft/class_6880;method_40224(Ljava/util/function/Predicate;)Znamed matchesLnet/minecraft/util/registry/RegistryEntry;matches(Ljava/util/function/Predicate;)Z
-
isIn
Returns whether this entry is intag.This always returns
falsefor direct entries, since tags are managed by a registry.- Returns:
- whether this entry is in
tag - Mappings:
Namespace Name Mixin selector official aLha;a(Lamg;)Zintermediary method_40220Lnet/minecraft/class_6880;method_40220(Lnet/minecraft/class_6862;)Znamed isInLnet/minecraft/util/registry/RegistryEntry;isIn(Lnet/minecraft/tag/TagKey;)Z
-
streamTags
Returns a stream of the tags of this entry, or an empty stream if this is a direct entry.- Returns:
- a stream of the tags of this entry, or an empty stream if this is a direct entry
- Mappings:
Namespace Name Mixin selector official cLha;c()Ljava/util/stream/Stream;intermediary method_40228Lnet/minecraft/class_6880;method_40228()Ljava/util/stream/Stream;named streamTagsLnet/minecraft/util/registry/RegistryEntry;streamTags()Ljava/util/stream/Stream;
-
getKeyOrValue
com.mojang.datafixers.util.Either<RegistryKey<T>,T> getKeyOrValue()Returns the object that identifies this registry key.For direct entries, this is the held value, and for reference entries, this is the key of the entry.
- Returns:
- the object that identifies this registry key
- Mappings:
Namespace Name Mixin selector official dLha;d()Lcom/mojang/datafixers/util/Either;intermediary method_40229Lnet/minecraft/class_6880;method_40229()Lcom/mojang/datafixers/util/Either;named getKeyOrValueLnet/minecraft/util/registry/RegistryEntry;getKeyOrValue()Lcom/mojang/datafixers/util/Either;
-
getKey
Optional<RegistryKey<T>> getKey()Returns the registry key of this entry, or an empty optional if this is a direct entry.- Returns:
- the registry key of this entry, or an empty optional if this is a direct entry
- Mappings:
Namespace Name Mixin selector official eLha;e()Ljava/util/Optional;intermediary method_40230Lnet/minecraft/class_6880;method_40230()Ljava/util/Optional;named getKeyLnet/minecraft/util/registry/RegistryEntry;getKey()Ljava/util/Optional;
-
getType
RegistryEntry.Type getType()Returns the type (direct or reference) of this registry entry.This is different from the types of reference registry entries, i.e. stand-alone or intrusive.
- Returns:
- the type (direct or reference) of this registry entry
- Mappings:
Namespace Name Mixin selector official fLha;f()Lha$b;intermediary method_40231Lnet/minecraft/class_6880;method_40231()Lnet/minecraft/class_6880$class_6882;named getTypeLnet/minecraft/util/registry/RegistryEntry;getType()Lnet/minecraft/util/registry/RegistryEntry$Type;
-
matchesRegistry
Returns whether the registry for the entry isregistry.This always returns
truefor direct entries.- Returns:
- whether the registry for the entry is
registry - Mappings:
Namespace Name Mixin selector official aLha;a(Lhl;)Zintermediary method_40222Lnet/minecraft/class_6880;method_40222(Lnet/minecraft/class_2378;)Znamed matchesRegistryLnet/minecraft/util/registry/RegistryEntry;matchesRegistry(Lnet/minecraft/util/registry/Registry;)Z
-
of
Returns a new direct registry entry ofvalue.- Returns:
- a new direct registry entry of
value - Mappings:
Namespace Name Mixin selector official aLha;a(Ljava/lang/Object;)Lha;intermediary method_40223Lnet/minecraft/class_6880;method_40223(Ljava/lang/Object;)Lnet/minecraft/class_6880;named ofLnet/minecraft/util/registry/RegistryEntry;of(Ljava/lang/Object;)Lnet/minecraft/util/registry/RegistryEntry;
-
upcast
CastsRegistryEntry<? extends T>toRegistryEntry<T>.- Returns:
- the cast value
- Mappings:
Namespace Name Mixin selector official aLha;a(Lha;)Lha;intermediary method_40221Lnet/minecraft/class_6880;method_40221(Lnet/minecraft/class_6880;)Lnet/minecraft/class_6880;named upcastLnet/minecraft/util/registry/RegistryEntry;upcast(Lnet/minecraft/util/registry/RegistryEntry;)Lnet/minecraft/util/registry/RegistryEntry;
-