Interface RegistryEntryList<T>

All Superinterfaces:
Iterable<RegistryEntry<T>>
All Known Implementing Classes:
RegistryEntryList.Direct, RegistryEntryList.ListBacked, RegistryEntryList.Named

public interface RegistryEntryList<T> extends Iterable<RegistryEntry<T>>
A registry entry list is an immutable list of registry entries. This, is either a direct reference to each item, or a reference to a tag. A tag is a way to dynamically define a list of registered values. Anything registered in a registry can be tagged, and each registry holds a list of tags it recognizes.

This can be iterated directly (i.e. for (RegistryEntry<T> entry : entries). Note that this does not implement Collection.

See Also:
Mappings:
Namespace Name
named net/minecraft/registry/entry/RegistryEntryList
intermediary net/minecraft/class_6885
official jn
  • Method Details

    • stream

      Stream<RegistryEntry<T>> stream()
      Returns a stream of registry entries in this list.
      Returns:
      a stream of registry entries in this list
      Mappings:
      Namespace Name Mixin selector
      named stream Lnet/minecraft/registry/entry/RegistryEntryList;stream()Ljava/util/stream/Stream;
      intermediary method_40239 Lnet/minecraft/class_6885;method_40239()Ljava/util/stream/Stream;
      official a Ljn;a()Ljava/util/stream/Stream;
    • size

      int size()
      Returns the number of entries in this list.
      Returns:
      the number of entries in this list
      Mappings:
      Namespace Name Mixin selector
      named size Lnet/minecraft/registry/entry/RegistryEntryList;size()I
      intermediary method_40247 Lnet/minecraft/class_6885;method_40247()I
      official b Ljn;b()I
    • getStorage

      com.mojang.datafixers.util.Either<TagKey<T>,List<RegistryEntry<T>>> getStorage()
      Returns the object that identifies this registry entry list.

      This is the tag key for a reference list, and the backing list for a direct list.

      Returns:
      the object that identifies this registry entry list
      Mappings:
      Namespace Name Mixin selector
      named getStorage Lnet/minecraft/registry/entry/RegistryEntryList;getStorage()Lcom/mojang/datafixers/util/Either;
      intermediary method_40248 Lnet/minecraft/class_6885;method_40248()Lcom/mojang/datafixers/util/Either;
      official c Ljn;c()Lcom/mojang/datafixers/util/Either;
    • getRandom

      Optional<RegistryEntry<T>> getRandom(Random random)
      Returns a random entry of the list, or an empty optional if this list is empty.
      Returns:
      a random entry of the list, or an empty optional if this list is empty
      Mappings:
      Namespace Name Mixin selector
      named getRandom Lnet/minecraft/registry/entry/RegistryEntryList;getRandom(Lnet/minecraft/util/math/random/Random;)Ljava/util/Optional;
      intermediary method_40243 Lnet/minecraft/class_6885;method_40243(Lnet/minecraft/class_5819;)Ljava/util/Optional;
      official a Ljn;a(Layo;)Ljava/util/Optional;
    • get

      RegistryEntry<T> get(int index)
      Returns the registry entry at index.
      Returns:
      the registry entry at index
      Throws:
      IndexOutOfBoundsException - if the index is out of bounds
      Mappings:
      Namespace Name Mixin selector
      named get Lnet/minecraft/registry/entry/RegistryEntryList;get(I)Lnet/minecraft/registry/entry/RegistryEntry;
      intermediary method_40240 Lnet/minecraft/class_6885;method_40240(I)Lnet/minecraft/class_6880;
      official a Ljn;a(I)Ljj;
    • contains

      boolean contains(RegistryEntry<T> entry)
      Returns whether entry is in this list.
      Returns:
      whether entry is in this list
      Mappings:
      Namespace Name Mixin selector
      named contains Lnet/minecraft/registry/entry/RegistryEntryList;contains(Lnet/minecraft/registry/entry/RegistryEntry;)Z
      intermediary method_40241 Lnet/minecraft/class_6885;method_40241(Lnet/minecraft/class_6880;)Z
      official a Ljn;a(Ljj;)Z
    • ownerEquals

      boolean ownerEquals(RegistryEntryOwner<T> owner)
      Mappings:
      Namespace Name Mixin selector
      named ownerEquals Lnet/minecraft/registry/entry/RegistryEntryList;ownerEquals(Lnet/minecraft/registry/entry/RegistryEntryOwner;)Z
      intermediary method_46768 Lnet/minecraft/class_6885;method_46768(Lnet/minecraft/class_7876;)Z
      official a Ljn;a(Ljm;)Z
    • getTagKey

      Optional<TagKey<T>> getTagKey()
      Mappings:
      Namespace Name Mixin selector
      named getTagKey Lnet/minecraft/registry/entry/RegistryEntryList;getTagKey()Ljava/util/Optional;
      intermediary method_45925 Lnet/minecraft/class_6885;method_45925()Ljava/util/Optional;
      official d Ljn;d()Ljava/util/Optional;
    • of

      Deprecated.
      Mappings:
      Namespace Name Mixin selector
      named of Lnet/minecraft/registry/entry/RegistryEntryList;of(Lnet/minecraft/registry/entry/RegistryEntryOwner;Lnet/minecraft/registry/tag/TagKey;)Lnet/minecraft/registry/entry/RegistryEntryList$Named;
      intermediary method_45924 Lnet/minecraft/class_6885;method_45924(Lnet/minecraft/class_7876;Lnet/minecraft/class_6862;)Lnet/minecraft/class_6885$class_6888;
      official a Ljn;a(Ljm;Lawm;)Ljn$c;
    • empty

      static <T> RegistryEntryList<T> empty()
      Mappings:
      Namespace Name Mixin selector
      named empty Lnet/minecraft/registry/entry/RegistryEntryList;empty()Lnet/minecraft/registry/entry/RegistryEntryList;
      intermediary method_58563 Lnet/minecraft/class_6885;method_58563()Lnet/minecraft/class_6885;
      official e Ljn;e()Ljn;
    • of

      @SafeVarargs static <T> RegistryEntryList.Direct<T> of(RegistryEntry<T>[] entries)
      Returns a new direct list of entries.
      Returns:
      a new direct list of entries
      Mappings:
      Namespace Name Mixin selector
      named of Lnet/minecraft/registry/entry/RegistryEntryList;of([Lnet/minecraft/registry/entry/RegistryEntry;)Lnet/minecraft/registry/entry/RegistryEntryList$Direct;
      intermediary method_40246 Lnet/minecraft/class_6885;method_40246([Lnet/minecraft/class_6880;)Lnet/minecraft/class_6885$class_6886;
      official a Ljn;a([Ljj;)Ljn$a;
    • of

      static <T> RegistryEntryList.Direct<T> of(List<? extends RegistryEntry<T>> entries)
      Returns a new direct list of entries.
      Returns:
      a new direct list of entries
      Mappings:
      Namespace Name Mixin selector
      named of Lnet/minecraft/registry/entry/RegistryEntryList;of(Ljava/util/List;)Lnet/minecraft/registry/entry/RegistryEntryList$Direct;
      intermediary method_40242 Lnet/minecraft/class_6885;method_40242(Ljava/util/List;)Lnet/minecraft/class_6885$class_6886;
      official a Ljn;a(Ljava/util/List;)Ljn$a;
    • of

      @SafeVarargs static <E, T> RegistryEntryList.Direct<T> of(Function<E,RegistryEntry<T>> mapper, E[] values)
      Returns a new direct list of values converted to a registry entry with mapper.
      Returns:
      a new direct list of values converted to a registry entry with mapper
      Mappings:
      Namespace Name Mixin selector
      named of Lnet/minecraft/registry/entry/RegistryEntryList;of(Ljava/util/function/Function;[Ljava/lang/Object;)Lnet/minecraft/registry/entry/RegistryEntryList$Direct;
      intermediary method_40245 Lnet/minecraft/class_6885;method_40245(Ljava/util/function/Function;[Ljava/lang/Object;)Lnet/minecraft/class_6885$class_6886;
      official a Ljn;a(Ljava/util/function/Function;[Ljava/lang/Object;)Ljn$a;
    • of

      static <E, T> RegistryEntryList.Direct<T> of(Function<E,RegistryEntry<T>> mapper, Collection<E> values)
      Returns a new direct list of values converted to a registry entry with mapper.
      Returns:
      a new direct list of values converted to a registry entry with mapper
      Mappings:
      Namespace Name Mixin selector
      named of Lnet/minecraft/registry/entry/RegistryEntryList;of(Ljava/util/function/Function;Ljava/util/Collection;)Lnet/minecraft/registry/entry/RegistryEntryList$Direct;
      intermediary method_40244 Lnet/minecraft/class_6885;method_40244(Ljava/util/function/Function;Ljava/util/Collection;)Lnet/minecraft/class_6885$class_6886;
      official a Ljn;a(Ljava/util/function/Function;Ljava/util/Collection;)Ljn$a;