Interface RegistryEntry<T>

All Known Implementing Classes:
RegistryBuilder.LazyReferenceEntry, RegistryEntry.Direct, RegistryEntry.Reference

public interface RegistryEntry<T>
An object holding a value that can be registered in a registry. In most cases, the value is already registered in a registry ("reference entry"), hence the name; however, it is possible to create a registry entry by direct reference ("direct entry"). This is useful for data packs, as they can define one-time use values directly without having to register them every time.

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
named net/minecraft/registry/entry/RegistryEntry
intermediary net/minecraft/class_6880
official jm
  • Method Details

    • value

      T value()
      Mappings:
      Namespace Name Mixin selector
      named value Lnet/minecraft/registry/entry/RegistryEntry;value()Ljava/lang/Object;
      intermediary comp_349 Lnet/minecraft/class_6880;comp_349()Ljava/lang/Object;
      official a Ljm;a()Ljava/lang/Object;
    • hasKeyAndValue

      boolean hasKeyAndValue()
      Mappings:
      Namespace Name Mixin selector
      named hasKeyAndValue Lnet/minecraft/registry/entry/RegistryEntry;hasKeyAndValue()Z
      intermediary method_40227 Lnet/minecraft/class_6880;method_40227()Z
      official b Ljm;b()Z
    • matchesId

      boolean matchesId(Identifier id)
      Returns whether the ID of this entry is id.

      This always returns false for direct entries.

      Returns:
      whether the ID of this entry is id
      Mappings:
      Namespace Name Mixin selector
      named matchesId Lnet/minecraft/registry/entry/RegistryEntry;matchesId(Lnet/minecraft/util/Identifier;)Z
      intermediary method_40226 Lnet/minecraft/class_6880;method_40226(Lnet/minecraft/class_2960;)Z
      official a Ljm;a(Lakr;)Z
    • matchesKey

      boolean matchesKey(RegistryKey<T> key)
      Returns whether the registry key of this entry is key.

      This always returns false for direct entries.

      Returns:
      whether the registry key of this entry is key
      Mappings:
      Namespace Name Mixin selector
      named matchesKey Lnet/minecraft/registry/entry/RegistryEntry;matchesKey(Lnet/minecraft/registry/RegistryKey;)Z
      intermediary method_40225 Lnet/minecraft/class_6880;method_40225(Lnet/minecraft/class_5321;)Z
      official a Ljm;a(Lakq;)Z
    • matches

      boolean matches(Predicate<RegistryKey<T>> predicate)
      Returns whether this entry's key matches predicate.

      This always returns false for direct entries.

      Returns:
      whether this entry's key matches predicate
      Mappings:
      Namespace Name Mixin selector
      named matches Lnet/minecraft/registry/entry/RegistryEntry;matches(Ljava/util/function/Predicate;)Z
      intermediary method_40224 Lnet/minecraft/class_6880;method_40224(Ljava/util/function/Predicate;)Z
      official a Ljm;a(Ljava/util/function/Predicate;)Z
    • isIn

      boolean isIn(TagKey<T> tag)
      Returns whether this entry is in tag.

      This always returns false for direct entries, since tags are managed by a registry.

      Returns:
      whether this entry is in tag
      Mappings:
      Namespace Name Mixin selector
      named isIn Lnet/minecraft/registry/entry/RegistryEntry;isIn(Lnet/minecraft/registry/tag/TagKey;)Z
      intermediary method_40220 Lnet/minecraft/class_6880;method_40220(Lnet/minecraft/class_6862;)Z
      official a Ljm;a(Lawu;)Z
    • matches

      @Deprecated boolean matches(RegistryEntry<T> entry)
      Deprecated.
      Mappings:
      Namespace Name Mixin selector
      named matches Lnet/minecraft/registry/entry/RegistryEntry;matches(Lnet/minecraft/registry/entry/RegistryEntry;)Z
      intermediary method_55838 Lnet/minecraft/class_6880;method_55838(Lnet/minecraft/class_6880;)Z
      official a Ljm;a(Ljm;)Z
    • streamTags

      Stream<TagKey<T>> 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
      named streamTags Lnet/minecraft/registry/entry/RegistryEntry;streamTags()Ljava/util/stream/Stream;
      intermediary method_40228 Lnet/minecraft/class_6880;method_40228()Ljava/util/stream/Stream;
      official c Ljm;c()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
      named getKeyOrValue Lnet/minecraft/registry/entry/RegistryEntry;getKeyOrValue()Lcom/mojang/datafixers/util/Either;
      intermediary method_40229 Lnet/minecraft/class_6880;method_40229()Lcom/mojang/datafixers/util/Either;
      official d Ljm;d()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
      named getKey Lnet/minecraft/registry/entry/RegistryEntry;getKey()Ljava/util/Optional;
      intermediary method_40230 Lnet/minecraft/class_6880;method_40230()Ljava/util/Optional;
      official e Ljm;e()Ljava/util/Optional;
    • 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
      named getType Lnet/minecraft/registry/entry/RegistryEntry;getType()Lnet/minecraft/registry/entry/RegistryEntry$Type;
      intermediary method_40231 Lnet/minecraft/class_6880;method_40231()Lnet/minecraft/class_6880$class_6882;
      official f Ljm;f()Ljm$b;
    • ownerEquals

      boolean ownerEquals(RegistryEntryOwner<T> owner)
      Mappings:
      Namespace Name Mixin selector
      named ownerEquals Lnet/minecraft/registry/entry/RegistryEntry;ownerEquals(Lnet/minecraft/registry/entry/RegistryEntryOwner;)Z
      intermediary method_46745 Lnet/minecraft/class_6880;method_46745(Lnet/minecraft/class_7876;)Z
      official a Ljm;a(Ljp;)Z
    • getIdAsString

      default String getIdAsString()
      Mappings:
      Namespace Name Mixin selector
      named getIdAsString Lnet/minecraft/registry/entry/RegistryEntry;getIdAsString()Ljava/lang/String;
      intermediary method_55840 Lnet/minecraft/class_6880;method_55840()Ljava/lang/String;
      official g Ljm;g()Ljava/lang/String;
    • of

      static <T> RegistryEntry<T> of(T value)
      Returns a new direct registry entry of value.
      Returns:
      a new direct registry entry of value
      Mappings:
      Namespace Name Mixin selector
      named of Lnet/minecraft/registry/entry/RegistryEntry;of(Ljava/lang/Object;)Lnet/minecraft/registry/entry/RegistryEntry;
      intermediary method_40223 Lnet/minecraft/class_6880;method_40223(Ljava/lang/Object;)Lnet/minecraft/class_6880;
      official a Ljm;a(Ljava/lang/Object;)Ljm;