Interface CommandRegistryWrapper<T>

All Known Implementing Classes:
CommandRegistryWrapper.Impl

public interface CommandRegistryWrapper<T>
A wrapper of a registry, used in command arguments.

The methods in this class in most cases perform the same as ones defined in Registry. However, subclasses may have slightly different behaviors to make it easier to handle user-passed arguments. For example, getEntryList(TagKey) may return an empty RegistryEntryList instead of Optional.empty().

A wrapper without any special behaviors can be created by calling {#link of(Registry)}.

Mappings:
Namespace Name
official hd
intermediary net/minecraft/class_7225
named net/minecraft/command/CommandRegistryWrapper
  • Method Details

    • getEntry

      Optional<RegistryEntry<T>> getEntry(RegistryKey<T> key)
      See Also:
      Mappings:
      Namespace Name Mixin selector
      official a Lhd;a(Laba;)Ljava/util/Optional;
      intermediary method_42019 Lnet/minecraft/class_7225;method_42019(Lnet/minecraft/class_5321;)Ljava/util/Optional;
      named getEntry Lnet/minecraft/command/CommandRegistryWrapper;getEntry(Lnet/minecraft/util/registry/RegistryKey;)Ljava/util/Optional;
    • streamKeys

      Stream<RegistryKey<T>> streamKeys()
      Returns a stream of registry keys defined in the wrapped registry.
      Returns:
      a stream of registry keys defined in the wrapped registry
      See Also:
      Mappings:
      Namespace Name Mixin selector
      official a Lhd;a()Ljava/util/stream/Stream;
      intermediary method_42017 Lnet/minecraft/class_7225;method_42017()Ljava/util/stream/Stream;
      named streamKeys Lnet/minecraft/command/CommandRegistryWrapper;streamKeys()Ljava/util/stream/Stream;
    • getEntryList

      Optional<? extends RegistryEntryList<T>> getEntryList(TagKey<T> tag)
      Returns the entry list for the provided tag.

      Implementations have different behaviors for unrecognized tags. The default implementation returns Optional.empty(); however, the ones created by CommandRegistryAccess.createWrapper(net.minecraft.util.registry.RegistryKey<? extends net.minecraft.util.registry.Registry<T>>) can create and return a new entry list, or return an empty entry list.

      Returns:
      the entry list for the provided tag
      See Also:
      Mappings:
      Namespace Name Mixin selector
      official a Lhd;a(Lakz;)Ljava/util/Optional;
      intermediary method_41700 Lnet/minecraft/class_7225;method_41700(Lnet/minecraft/class_6862;)Ljava/util/Optional;
      named getEntryList Lnet/minecraft/command/CommandRegistryWrapper;getEntryList(Lnet/minecraft/tag/TagKey;)Ljava/util/Optional;
    • streamTags

      Stream<TagKey<T>> streamTags()
      See Also:
      Mappings:
      Namespace Name Mixin selector
      official b Lhd;b()Ljava/util/stream/Stream;
      intermediary method_42020 Lnet/minecraft/class_7225;method_42020()Ljava/util/stream/Stream;
      named streamTags Lnet/minecraft/command/CommandRegistryWrapper;streamTags()Ljava/util/stream/Stream;
    • of

      static <T> CommandRegistryWrapper<T> of(Registry<T> registry)
      Returns a new wrapper for the registry without any special behaviors.
      Returns:
      a new wrapper for the registry without any special behaviors
      Mappings:
      Namespace Name Mixin selector
      official a Lhd;a(Lhm;)Lhd;
      intermediary method_42018 Lnet/minecraft/class_7225;method_42018(Lnet/minecraft/class_2378;)Lnet/minecraft/class_7225;
      named of Lnet/minecraft/command/CommandRegistryWrapper;of(Lnet/minecraft/util/registry/Registry;)Lnet/minecraft/command/CommandRegistryWrapper;