Class SimpleDefaultedRegistry<T>

java.lang.Object
net.minecraft.registry.SimpleRegistry<T>
net.minecraft.registry.SimpleDefaultedRegistry<T>
All Implemented Interfaces:
com.mojang.serialization.Keyable, Iterable<T>, DefaultedRegistry<T>, RegistryEntryOwner<T>, MutableRegistry<T>, Registry<T>, RegistryEntryLookup<T>, RegistryWrapper<T>, RegistryWrapper.Impl<T>, IndexedIterable<T>

public class SimpleDefaultedRegistry<T> extends SimpleRegistry<T> implements DefaultedRegistry<T>
An implementation of Registry with a default ID and value for unknown lookups.
Mappings:
Namespace Name
named net/minecraft/registry/SimpleDefaultedRegistry
intermediary net/minecraft/class_2348
official jk
  • Field Details

    • defaultId

      private final Identifier defaultId
      Mappings:
      Namespace Name Mixin selector
      named defaultId Lnet/minecraft/registry/SimpleDefaultedRegistry;defaultId:Lnet/minecraft/util/Identifier;
      intermediary field_11014 Lnet/minecraft/class_2348;field_11014:Lnet/minecraft/class_2960;
      official b Ljk;b:Lalz;
    • defaultEntry

      private RegistryEntry.Reference<T> defaultEntry
      Mappings:
      Namespace Name Mixin selector
      named defaultEntry Lnet/minecraft/registry/SimpleDefaultedRegistry;defaultEntry:Lnet/minecraft/registry/entry/RegistryEntry$Reference;
      intermediary field_11015 Lnet/minecraft/class_2348;field_11015:Lnet/minecraft/class_6880$class_6883;
      official c Ljk;c:Ljq$c;
  • Constructor Details

    • SimpleDefaultedRegistry

      public SimpleDefaultedRegistry(String defaultId, RegistryKey<? extends Registry<T>> key, com.mojang.serialization.Lifecycle lifecycle, boolean intrusive)
      Mappings:
      Namespace Name Mixin selector
      named <init> Lnet/minecraft/registry/SimpleDefaultedRegistry;<init>(Ljava/lang/String;Lnet/minecraft/registry/RegistryKey;Lcom/mojang/serialization/Lifecycle;Z)V
      intermediary <init> Lnet/minecraft/class_2348;<init>(Ljava/lang/String;Lnet/minecraft/class_5321;Lcom/mojang/serialization/Lifecycle;Z)V
      official <init> Ljk;<init>(Ljava/lang/String;Laly;Lcom/mojang/serialization/Lifecycle;Z)V
  • Method Details

    • add

      public RegistryEntry.Reference<T> add(RegistryKey<T> key, T value, RegistryEntryInfo info)
      Specified by:
      add in interface MutableRegistry<T>
      Overrides:
      add in class SimpleRegistry<T>
      Mappings:
      Namespace Name Mixin selector
      named add Lnet/minecraft/registry/MutableRegistry;add(Lnet/minecraft/registry/RegistryKey;Ljava/lang/Object;Lnet/minecraft/registry/entry/RegistryEntryInfo;)Lnet/minecraft/registry/entry/RegistryEntry$Reference;
      intermediary method_10272 Lnet/minecraft/class_2385;method_10272(Lnet/minecraft/class_5321;Ljava/lang/Object;Lnet/minecraft/class_9248;)Lnet/minecraft/class_6880$class_6883;
      official a Lkm;a(Laly;Ljava/lang/Object;Lkc;)Ljq$c;
    • getRawId

      public int getRawId(@Nullable T value)
      Specified by:
      getRawId in interface IndexedIterable<T>
      Specified by:
      getRawId in interface Registry<T>
      Overrides:
      getRawId in class SimpleRegistry<T>
      Mappings:
      Namespace Name Mixin selector
      named getRawId Lnet/minecraft/util/collection/IndexedIterable;getRawId(Ljava/lang/Object;)I
      intermediary method_10206 Lnet/minecraft/class_2359;method_10206(Ljava/lang/Object;)I
      official a Ljv;a(Ljava/lang/Object;)I
    • getId

      @NotNull public @NotNull Identifier getId(T value)
      Returns the ID assigned to value, or null if it is not registered.
      Specified by:
      getId in interface DefaultedRegistry<T>
      Specified by:
      getId in interface Registry<T>
      Overrides:
      getId in class SimpleRegistry<T>
      Returns:
      the ID assigned to value, or null if it is not registered
      Mappings:
      Namespace Name Mixin selector
      named getId Lnet/minecraft/registry/Registry;getId(Ljava/lang/Object;)Lnet/minecraft/util/Identifier;
      intermediary method_10221 Lnet/minecraft/class_2378;method_10221(Ljava/lang/Object;)Lnet/minecraft/class_2960;
      official b Lkd;b(Ljava/lang/Object;)Lalz;
    • get

      Returns the value that is assigned id, or null if there is none.
      Specified by:
      get in interface DefaultedRegistry<T>
      Specified by:
      get in interface Registry<T>
      Overrides:
      get in class SimpleRegistry<T>
      Returns:
      the value that is assigned id, or null if there is none
      Mappings:
      Namespace Name Mixin selector
      named get Lnet/minecraft/registry/Registry;get(Lnet/minecraft/util/Identifier;)Ljava/lang/Object;
      intermediary method_63535 Lnet/minecraft/class_2378;method_63535(Lnet/minecraft/class_2960;)Ljava/lang/Object;
      official a Lkd;a(Lalz;)Ljava/lang/Object;
    • getOptionalValue

      public Optional<T> getOptionalValue(@Nullable @Nullable Identifier id)
      Returns the value that is assigned id, or an empty optional if there is none.
      Specified by:
      getOptionalValue in interface Registry<T>
      Returns:
      the value that is assigned id, or an empty optional if there is none
      Mappings:
      Namespace Name Mixin selector
      named getOptionalValue Lnet/minecraft/registry/Registry;getOptionalValue(Lnet/minecraft/util/Identifier;)Ljava/util/Optional;
      intermediary method_17966 Lnet/minecraft/class_2378;method_17966(Lnet/minecraft/class_2960;)Ljava/util/Optional;
      official b Lkd;b(Lalz;)Ljava/util/Optional;
    • getDefaultEntry

      public Optional<RegistryEntry.Reference<T>> getDefaultEntry()
      Specified by:
      getDefaultEntry in interface Registry<T>
      Overrides:
      getDefaultEntry in class SimpleRegistry<T>
      Mappings:
      Namespace Name Mixin selector
      named getDefaultEntry Lnet/minecraft/registry/Registry;getDefaultEntry()Ljava/util/Optional;
      intermediary method_60385 Lnet/minecraft/class_2378;method_60385()Ljava/util/Optional;
      official a Lkd;a()Ljava/util/Optional;
    • get

      @NotNull public T get(int index)
      Specified by:
      get in interface DefaultedRegistry<T>
      Specified by:
      get in interface IndexedIterable<T>
      Overrides:
      get in class SimpleRegistry<T>
      Mappings:
      Namespace Name Mixin selector
      named get Lnet/minecraft/util/collection/IndexedIterable;get(I)Ljava/lang/Object;
      intermediary method_10200 Lnet/minecraft/class_2359;method_10200(I)Ljava/lang/Object;
      official a Ljv;a(I)Ljava/lang/Object;
    • getRandom

      public Optional<RegistryEntry.Reference<T>> getRandom(Random random)
      Returns a random registry entry from this registry, or an empty optional if the registry is empty.
      Specified by:
      getRandom in interface Registry<T>
      Overrides:
      getRandom in class SimpleRegistry<T>
      Returns:
      a random registry entry from this registry, or an empty optional if the registry is empty
      Mappings:
      Namespace Name Mixin selector
      named getRandom Lnet/minecraft/registry/Registry;getRandom(Lnet/minecraft/util/math/random/Random;)Ljava/util/Optional;
      intermediary method_10240 Lnet/minecraft/class_2378;method_10240(Lnet/minecraft/class_5819;)Ljava/util/Optional;
      official a Lkd;a(Lbam;)Ljava/util/Optional;
    • getDefaultId

      public Identifier getDefaultId()
      Specified by:
      getDefaultId in interface DefaultedRegistry<T>
      Mappings:
      Namespace Name Mixin selector
      named getDefaultId Lnet/minecraft/registry/DefaultedRegistry;getDefaultId()Lnet/minecraft/util/Identifier;
      intermediary method_10137 Lnet/minecraft/class_7922;method_10137()Lnet/minecraft/class_2960;
      official b Ljl;b()Lalz;