Package net.minecraft.registry.entry
Interface RegistryEntryList<T>
- All Superinterfaces:
Iterable<RegistryEntry<T>>
- All Known Implementing Classes:
RegistryEntryList.Direct,RegistryEntryList.ListBacked,RegistryEntryList.Named
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 official hiintermediary net/minecraft/class_6885named net/minecraft/registry/entry/RegistryEntryList
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic classA direct registry entry list that holds the values directly, instead of using tags.static classAn internal implementation ofRegistryEntryList.static classA registry entry list that references a tag from the registry. -
Method Summary
Modifier and TypeMethodDescriptionbooleancontains(RegistryEntry<T> entry) Returns whetherentryis in this list.get(int index) Returns the registry entry atindex.Returns a random entry of the list, or an empty optional if this list is empty.com.mojang.datafixers.util.Either<TagKey<T>,List<RegistryEntry<T>>> Returns the object that identifies this registry entry list.static <E,T> RegistryEntryList.Direct<T> of(Function<E, RegistryEntry<T>> mapper, E[] values) Returns a new direct list ofvaluesconverted to a registry entry withmapper.static <E,T> RegistryEntryList.Direct<T> of(Function<E, RegistryEntry<T>> mapper, List<E> values) Returns a new direct list ofvaluesconverted to a registry entry withmapper.static <T> RegistryEntryList.Direct<T>of(List<? extends RegistryEntry<T>> entries) Returns a new direct list ofentries.static <T> RegistryEntryList.Direct<T>of(RegistryEntry<T>[] entries) Returns a new direct list ofentries.static <T> RegistryEntryList.Named<T>of(RegistryEntryOwner<T> owner, TagKey<T> tagKey) Deprecated.booleanownerEquals(RegistryEntryOwner<T> owner) intsize()Returns the number of entries in this list.stream()Returns a stream of registry entries in this list.Methods inherited from interface java.lang.Iterable
forEach, iterator, spliterator
-
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 official aLhi;a()Ljava/util/stream/Stream;intermediary method_40239Lnet/minecraft/class_6885;method_40239()Ljava/util/stream/Stream;named streamLnet/minecraft/registry/entry/RegistryEntryList;stream()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 official bLhi;b()Iintermediary method_40247Lnet/minecraft/class_6885;method_40247()Inamed sizeLnet/minecraft/registry/entry/RegistryEntryList;size()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 official cLhi;c()Lcom/mojang/datafixers/util/Either;intermediary method_40248Lnet/minecraft/class_6885;method_40248()Lcom/mojang/datafixers/util/Either;named getStorageLnet/minecraft/registry/entry/RegistryEntryList;getStorage()Lcom/mojang/datafixers/util/Either;
-
getRandom
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 official aLhi;a(Lapf;)Ljava/util/Optional;intermediary method_40243Lnet/minecraft/class_6885;method_40243(Lnet/minecraft/class_5819;)Ljava/util/Optional;named getRandomLnet/minecraft/registry/entry/RegistryEntryList;getRandom(Lnet/minecraft/util/math/random/Random;)Ljava/util/Optional;
-
get
Returns the registry entry atindex.- Returns:
- the registry entry at
index - Throws:
IndexOutOfBoundsException- if the index is out of bounds- Mappings:
Namespace Name Mixin selector official aLhi;a(I)Lhe;intermediary method_40240Lnet/minecraft/class_6885;method_40240(I)Lnet/minecraft/class_6880;named getLnet/minecraft/registry/entry/RegistryEntryList;get(I)Lnet/minecraft/registry/entry/RegistryEntry;
-
contains
Returns whetherentryis in this list.- Returns:
- whether
entryis in this list - Mappings:
Namespace Name Mixin selector official aLhi;a(Lhe;)Zintermediary method_40241Lnet/minecraft/class_6885;method_40241(Lnet/minecraft/class_6880;)Znamed containsLnet/minecraft/registry/entry/RegistryEntryList;contains(Lnet/minecraft/registry/entry/RegistryEntry;)Z
-
ownerEquals
- Mappings:
Namespace Name Mixin selector official aLhi;a(Lhh;)Zintermediary method_46768Lnet/minecraft/class_6885;method_46768(Lnet/minecraft/class_7876;)Znamed ownerEqualsLnet/minecraft/registry/entry/RegistryEntryList;ownerEquals(Lnet/minecraft/registry/entry/RegistryEntryOwner;)Z
-
getTagKey
- Mappings:
Namespace Name Mixin selector official dLhi;d()Ljava/util/Optional;intermediary method_45925Lnet/minecraft/class_6885;method_45925()Ljava/util/Optional;named getTagKeyLnet/minecraft/registry/entry/RegistryEntryList;getTagKey()Ljava/util/Optional;
-
of
@VisibleForTesting @Deprecated static <T> RegistryEntryList.Named<T> of(RegistryEntryOwner<T> owner, TagKey<T> tagKey) Deprecated.- Mappings:
Namespace Name Mixin selector official aLhi;a(Lhh;Lanl;)Lhi$c;intermediary method_45924Lnet/minecraft/class_6885;method_45924(Lnet/minecraft/class_7876;Lnet/minecraft/class_6862;)Lnet/minecraft/class_6885$class_6888;named ofLnet/minecraft/registry/entry/RegistryEntryList;of(Lnet/minecraft/registry/entry/RegistryEntryOwner;Lnet/minecraft/registry/tag/TagKey;)Lnet/minecraft/registry/entry/RegistryEntryList$Named;
-
of
Returns a new direct list ofentries.- Returns:
- a new direct list of
entries - Mappings:
Namespace Name Mixin selector official aLhi;a([Lhe;)Lhi$a;intermediary method_40246Lnet/minecraft/class_6885;method_40246([Lnet/minecraft/class_6880;)Lnet/minecraft/class_6885$class_6886;named ofLnet/minecraft/registry/entry/RegistryEntryList;of([Lnet/minecraft/registry/entry/RegistryEntry;)Lnet/minecraft/registry/entry/RegistryEntryList$Direct;
-
of
Returns a new direct list ofentries.- Returns:
- a new direct list of
entries - Mappings:
Namespace Name Mixin selector official aLhi;a(Ljava/util/List;)Lhi$a;intermediary method_40242Lnet/minecraft/class_6885;method_40242(Ljava/util/List;)Lnet/minecraft/class_6885$class_6886;named ofLnet/minecraft/registry/entry/RegistryEntryList;of(Ljava/util/List;)Lnet/minecraft/registry/entry/RegistryEntryList$Direct;
-
of
@SafeVarargs static <E,T> RegistryEntryList.Direct<T> of(Function<E, RegistryEntry<T>> mapper, E[] values) Returns a new direct list ofvaluesconverted to a registry entry withmapper.- Returns:
- a new direct list of
valuesconverted to a registry entry withmapper - Mappings:
Namespace Name Mixin selector official aLhi;a(Ljava/util/function/Function;[Ljava/lang/Object;)Lhi$a;intermediary method_40245Lnet/minecraft/class_6885;method_40245(Ljava/util/function/Function;[Ljava/lang/Object;)Lnet/minecraft/class_6885$class_6886;named ofLnet/minecraft/registry/entry/RegistryEntryList;of(Ljava/util/function/Function;[Ljava/lang/Object;)Lnet/minecraft/registry/entry/RegistryEntryList$Direct;
-
of
Returns a new direct list ofvaluesconverted to a registry entry withmapper.- Returns:
- a new direct list of
valuesconverted to a registry entry withmapper - Mappings:
Namespace Name Mixin selector official aLhi;a(Ljava/util/function/Function;Ljava/util/List;)Lhi$a;intermediary method_40244Lnet/minecraft/class_6885;method_40244(Ljava/util/function/Function;Ljava/util/List;)Lnet/minecraft/class_6885$class_6886;named ofLnet/minecraft/registry/entry/RegistryEntryList;of(Ljava/util/function/Function;Ljava/util/List;)Lnet/minecraft/registry/entry/RegistryEntryList$Direct;
-